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

how to send request strcut with bytes? #22

Closed
ray1888 opened this issue Jul 23, 2018 · 7 comments
Closed

how to send request strcut with bytes? #22

ray1888 opened this issue Jul 23, 2018 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@ray1888
Copy link

ray1888 commented Jul 23, 2018

syntax = "proto3";
package protobuf;

message Request{
    string method_name = 1;
    bytes arg = 2;
}

message Response{
    bytes res = 1;
}

service RemoteCall{
  rpc get_result(Request) returns(Response){}
  rpc get_feature(Request) returns(Response){}
  rpc get_detectResult(Request) returns(Response){}
  rpc get_emotion(Request) returns(Response){}
}

the protobuf file as above , how can i send bytes on your cli tools?

@bojand bojand self-assigned this Jul 23, 2018
@ray1888
Copy link
Author

ray1888 commented Jul 23, 2018

i use like this , and it doesn't work well

./ghz -proto ./call.proto -call protobuf.RemoteCall.get_result -d '{"method_name":"GET", "arg":"(lp0\nS'GET'\np1\naS'1'\np2\naS'cp431'\np3\na(dp4\nS'group_name'\np5\ng3\nsa."}' -n 2000 -c 50 172.17.82.212:8902

@bojand
Copy link
Owner

bojand commented Jul 26, 2018

I am not sure how to accomplish this practically, I'll have to think about it look into it further.

@ray1888
Copy link
Author

ray1888 commented Jul 26, 2018

so mark it as a feature request?@bojand

@bojand bojand added the enhancement New feature or request label Jul 26, 2018
@bojand
Copy link
Owner

bojand commented Jul 31, 2018

One option would be to provide support for reading binary serialized data. So for example you would provide a file (or via stdin) with the full message that's been serialized using protobuf. We could read it unmarshal it and use it as payload.

@tweej
Copy link

tweej commented Oct 11, 2018

Protobuf's encoding of strings is described here, which should be similar to how bytes are handled: https://developers.google.com/protocol-buffers/docs/encoding#types

I like the idea of pre-serializing the binary data and feeding that as an input file/stdin. (Or having ghz use protobuf to serialize a binary file provided as input.)

+1 for this feature request. I don't have a use for this tool without this feature.

@bojand
Copy link
Owner

bojand commented Oct 16, 2018

Hello, I agree this would be useful. The issue got a bit forgotten. I'll try and implement something soon-ish as I find the time. Thanks.

@bojand
Copy link
Owner

bojand commented Oct 18, 2018

Hello, can you try the 0.14.0 release and check if it works for your use cases. I am closing this issue. If there are problems please feel free to open a new issue with all the details.

@bojand bojand closed this as completed Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants