Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi form parameters in API #2097

Closed
edieruby opened this issue Jul 6, 2022 · 8 comments · Fixed by #4498
Closed

multi form parameters in API #2097

edieruby opened this issue Jul 6, 2022 · 8 comments · Fixed by #4498

Comments

@edieruby
Copy link
Contributor

edieruby commented Jul 6, 2022

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
gin-gonic/gin#408

@kesonan
Copy link
Collaborator

kesonan commented Jul 11, 2022

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%         

@edieruby
Copy link
Contributor Author

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`

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Aug 14, 2022
@wanghaoxi3000
Copy link

Same question, so i has to set value by manual

@github-actions github-actions bot removed the stale label Sep 23, 2022
@silves-xiang
Copy link

I have the same question , but can not handle this issue

@cannian1
Copy link

Same question,in get request

@Of-qinhai
Copy link

Up to now, the problem still exists, and there is no good solution

@kevwan kevwan linked a pull request Jan 27, 2025 that will close this issue
@kevwan
Copy link
Contributor

kevwan commented Jan 27, 2025

Already supported.

@kevwan kevwan closed this as completed Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants