Answer the question
In order to leave comments, you need to log in
How to make optional post request parameters?
Good evening!
There is a web service that receives post-requests to one of the addresses, which are designed to filter data.
Filtering parameters come in the form of json.
now works like:
type ItemsFilters struct {
ItemIds []int `json:"item_ids"`
ParamA bool `json:"param_a"`
ParamB bool `json:"param_b"`
ParamC bool `json:"param_c"`
}
var filters ItemsFilters
context.bindJSON(&filters)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question