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

Any example or doc of sending large data from Postman (json) to the server using client side streaming? #1100

Closed
cyantarek opened this issue Dec 16, 2019 · 4 comments

Comments

@cyantarek
Copy link

cyantarek commented Dec 16, 2019

Hello,

I want to send a very large string to the server. Instead of sending it once, I thought to send it through client side streaming. So my protobuf looks like kind of this one:

service AbcService {
    rpc Send(stream Request) returns (Response) {
        option (google.api.http) = {
            post: "/api/data/send"
            body: "*"
        };
    }
}

message Request {
    string body = 1;
}

message Response {
    string status = 1;
}

Now I want to send the request with large string inside a json through Postman using Client Side Streaming. How can I do this? I can not find any examples in the repo and I don't know how to achieve what I want.

Thanks.

@johanbrandhorst
Copy link
Collaborator

Hi @cyantarek. Unfortunately client side streaming isn't supported by browsers or many HTTP clients. I don't know how to use Postman for this. You can however use this in the gateway. See https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/stream.pb.gw.go#L36 for a generated code implementation, and https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/stream.proto#L12 for the proto definition. The Gateway parser will expect the messages to be sent in the body.

@johanbrandhorst
Copy link
Collaborator

@cyantarek
Copy link
Author

Thanks for super quick response. I like your dedication Johan Brandhorst. I'll definitely check out.

@camerondurham
Copy link

camerondurham commented Nov 21, 2020

Thanks again for your help! Updated links for example directories in 2020 (examples --> examples/internal)

Integration test:

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

3 participants