I have form-data like send by using postman. But I don't know how to create struct to bind that data
Anyone can have me please!
Comment From: thinkerou
please see QueryArray
and PostFormArray
Comment From: syssam
using JSON post will be better. a lot form type support not well
Comment From: thuandoan274
This is my struct
type BusinessPayloadRequest struct {
Location struct {
Latitude float64 `form:"latitude" bson:"latitude"`
Longitude float64 `form:"longitude" bson:"longitude"`
} `form:"location" bson:"-"`
AddressComponents []AddressComponents `form:"addressComponents[]" bson:"addressComponents"`
WorkingHours []WorkingHour `form:"workingHours" bson:"workingHours"`
}
type WorkingHour struct {
OpenHour int `form:"openHour" bson:"openHour"`
OpenMinute int `form:"openMinute" bson:"openMinute"`
CloseHour int `form:"closeHour" bson:"closeHour"`
CloseMinute int `form:"closeMinute" bson:"closeMinute"`
}
How use c.Bind but seem doesn't working
Comment From: syssam
Bind does not support these type, you need post json data. Bind form only support a basic type, like string, int..etc
Comment From: thuandoan274
Yes, I think like you. Ok I'll use content type application/json
Comment From: aight8
I think this should be supported because HTML forms without JS cannot send any JSON encoded forms. Furthermore if a file field is included in the form, multipart form encoding is the only possible option.
Comment From: Double1996
please fix this
Comment From: bingtianyiyan
hello,is there any plan to support form for bind array,this is very useful func!
Comment From: rfx77
Same problem here. I ended up using https://github.com/go-playground/form