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

Is map in query param supported? #37

Open
zhengbuqian opened this issue Oct 25, 2019 · 1 comment
Open

Is map in query param supported? #37

zhengbuqian opened this issue Oct 25, 2019 · 1 comment

Comments

@zhengbuqian
Copy link

In my use case my GetSomethingRequest includes a map<string, string>, and I didn't manage to pass the map as a query param. So I have to attach a body to the GET request which is bad. This is how I define the messages and service:

message Key {
    map<string, string> data = 1;
    string field = 2;
}
message GetSomethingRequest {
    string parent = 1;
    Key key = 2;
}
service SomeService {
    rpc GetSomething(GetSomethingRequest) returns (Something) {
        option (google.api.http) = {
            get: "/v1/parent/{parent}/somethings"
        };
    }
}

I tried the following and neither of them works.

// also tried to replace [, ], {, }, :, = with percent encode.
// the first two are following https://github.com/grpc-ecosystem/grpc-gateway/pull/535
GET /v1/parent/parentname/somethings?field=aa&data[abc]=cba
GET /v1/parent/parentname/somethings?key.field=aa&key.data[abc]=cba
GET /v1/parent/parentname/somethings?key.field=aa&key.data={abc:cba}

So I wonder if map of primitives as query param is supported? If not any plans to add support for this? Thanks!

@ambaumann
Copy link

This is really confusing because the grpc gateway project looks to support this behavior but I too an unable to get this to work through this transcoder as mentioned above. Would love to see a response on this. Again mentioning the feature in gateway that allows for map query parameters. grpc-ecosystem/grpc-gateway#535

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