go-zero
go-zero copied to clipboard
multi form parameters in API
AReq {
B []string form:"b,optional"
}
It seems that this multi parameters does not support? Can support?
Similar like follow:
https://stackoverflow.com/questions/39736243/ho-to-bind-to-slice-values-in-go-gin-form https://github.com/gin-gonic/gin/issues/408
It works well, there has a api which contains content as following
type Request {
In []string `form:"in,optional"`
}
type Response {
Out []string `json:"out"`
}
@server (
group: test
)
service greet-api {
@handler Greet
post /list (Request) returns (Response)
}
go run greet.go
Starting server at 0.0.0.0:8888...
$ curl --request POST 'http://127.0.0.1:8888/list'
null%
type Request {
A []string form:"a"
}
type Response {
Message string json:"message"
}
service test-api { @handler TestHandler get /from (Request) returns (Response) }
curl --request GET 'http://127.0.0.1:8888/from?a=abc12&a=abc12'
response:
string: `abc12`, error: `invalid character 'a' looking for beginning of value`
This issue is stale because it has been open for 30 days with no activity.
Same question, so i has to set value by manual
I have the same question , but can not handle this issue
Same question,in get request