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

HTTP GET with query params error #1245

Closed
jackwener opened this issue Apr 28, 2020 · 1 comment
Closed

HTTP GET with query params error #1245

jackwener opened this issue Apr 28, 2020 · 1 comment

Comments

@jackwener
Copy link

jackwener commented Apr 28, 2020

// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`

I found it is supported in above document.

but something went wrong in practice

phenomenon

get: /dyeing/appid/{appid}/id_type/{id_type}?page_num={page_num}&page_size={page_size}

error

--grpc-gateway_out: unexpected token "?page_num=" after segments "dyeing/appid/{appid}/id_type/{id_type}": /dyeing/appid/{appid}/id_type/{id_type}?page_num={page_num}&page_size={page_size}

@johanbrandhorst
Copy link
Collaborator

Hi again @jackwener, in the future could you please join the support channel on Gophers slack (#grpc-gateway) like the issue template asks? This is not a bug but a simple misunderstanding.

See

// Any fields in the request message which are not bound by the path
// pattern automatically become (optional) HTTP query
// parameters. Assume the following definition of the request message:
. The query parameters are implicitly bound to any variables not specified in the path. What you're looking for is

get: /dyeing/appid/{appid}/id_type/{id_type}

That should allow

GET /dyeing/appid/{appid}/id_type/{id_type}?page_num={page_num}&page_size={page_size}

To work.

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

No branches or pull requests

2 participants