Closed
Description
Package version v3.1.4
Issue: Decoder picks only one value when the array is present in query params as Array[]=x&Array[]=y
Code sample, to showcase or reproduce:
package main
import (
"fmt"
"log"
"net/url"
"github.com/go-playground/form/v4"
)
type PostsRequest struct {
PostIds []string
Projections []string
}
var decoder *form.Decoder
func main() {
decoder = form.NewDecoder()
values := parseForm()
var req PostsRequest
err := decoder.Decode(&req, values)
if err != nil {
log.Panic(err)
}
fmt.Printf("%#v\n", req)
}
func parseForm() url.Values {
return url.Values{
"PostIds[]": []string{"1", "2"},
}
}
Metadata
Metadata
Assignees
Labels
No labels