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

Add curl example using protobuf format to wiki #22

Closed
leighmcculloch opened this issue Jan 18, 2018 · 7 comments
Closed

Add curl example using protobuf format to wiki #22

leighmcculloch opened this issue Jan 18, 2018 · 7 comments

Comments

@leighmcculloch
Copy link
Contributor

The wiki has an example of how to curl using the json format here:
https://github.com/twitchtv/twirp/wiki/HTTP-Routing-and-Serialization#making-requests-on-the-command-line-with-curl

It would be useful I think if this section also contained an example of how to curl using protobuf, which is possible if the user has protoc installed, which is likely since it's required for building the autogenerated code.

e.g.

echo "inches:10" \
	| protoc --proto_path=$GOPATH/src --encode twirp.example.haberdasher.Size ./rpc/haberdasher/service.proto \
	| curl -s --request POST --header "Content-Type: application/protobuf" --data-binary @- http://localhost:8080/twirp/twirp.example.haberdasher.Haberdasher/MakeHat \
	| protoc --proto_path=$GOPATH/src --decode twirp.example.haberdasher.Hat ./rpc/haberdasher/service.proto

I'd open a PR to add it to docs, but I don't see a way of doing that since the docs are in the github wiki and not in the repo.

@spenczar
Copy link
Contributor

Wow, this is pretty cool. I think this is worth putting somewhere, but I'm not totally sure where just yet.

Let's wait until we have some better-structured docs, which should come via #1 - I'd like to move off the wiki, it's hard for people to contribute to.

@leighmcculloch
Copy link
Contributor Author

#1 is closed now, where's the right place to open a PR for this change?

@spenczar
Copy link
Contributor

spenczar commented Feb 8, 2018

Right, sorry about that. I've got a new pass at docs, #75, which I plan to merge today, hold tight.

@leighmcculloch
Copy link
Contributor Author

@spenczar Still worth including this in the docs? Or should we close this?

@leighmcculloch
Copy link
Contributor Author

Also, new docs look great 😄.

@spenczar
Copy link
Contributor

Yeah, it's still worth adding this somewhere - it's just such a good trick.

@leighmcculloch
Copy link
Contributor Author

@spenczar Added a doc page containing JSON and Protobuf examples for cURLing in #109.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants