I have a POST endpoint in my Java service that expects a protobuf 3 payload. This service is used by other services which send the protobuf payload. I would like to do some debugging and send a protobuf payload to the service via a curl
command, however, I have no idea how to construct such a payload, given it's a binary protocol.
Asked
Active
Viewed 2,170 times
5

user4184113
- 976
- 2
- 11
- 29
1 Answers
2
You can use protoCURL for this purpose. It's a command-line tool to send and receive protobuf HTTP REST requests while writing them in the Protobuf Text or JSON format.
A request could look something like this:
protocurl -I path/to/protos -i ..MyRequest -o ..MyResponse \
-u http://host/path/o/endpoint -d 'someField: "some-string", someIntField: 42'
And the response may look like this:
=========================== Request Text =========================== >>>
someField: "my-string"
someIntField: 42
=========================== Response Text =========================== <<<
someResponseField: "The answer for everything!"
someOtherResonseMessage: {
fooEnum: BAR
}
You can find more examples for how to use it in the repository.
(Disclaimer: I am the author of this tool and created it, because I had the same problem and needed a better tool.)

Golly Ticker
- 31
- 3
-
Wonderful tool! – Vlad Dinulescu Apr 07 '23 at 20:07