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 possible send raw post payload #356

Closed
a-x- opened this issue May 14, 2015 · 7 comments
Closed

Is possible send raw post payload #356

a-x- opened this issue May 14, 2015 · 7 comments

Comments

@a-x-
Copy link

a-x- commented May 14, 2015

... w/o escaping and another magic

Is it really?

Under option like --raw-payload

@jkbrzt
Copy link
Member

jkbrzt commented May 14, 2015

Yes, any data passed in via STDIN will be sent as the request body, e.g.:

$ echo 'raw payload' | http httpbin.org/post

https://github.com/jakubroztocil/httpie#redirected-input

@a-x-
Copy link
Author

a-x- commented May 18, 2015

Thank you, Jakub!

@mrcoles
Copy link

mrcoles commented Apr 20, 2016

Other than --ignore-stdin I don’t see any mention of this inside http --help, might it be a good addition to the help text? (Also, awesome job on this!)

@henrik242
Copy link

You can also use http httpbin.org/post <<< 'raw payload'

@furkanmustafa
Copy link

But,

$ echo 'running' | http -v put localhost:5000/state

is sending Content-Type: application/json header.

PUT /state HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 8
Content-Type: application/json
Host: localhost:5000
User-Agent: HTTPie/0.9.9

running

and a proper implementation on the receiving end is of course trying to parse that as a JSON, and failing.

@vlcinsky
Copy link

@furkanmustafa application/json is default content-type used by httpie.

If you explicitly state the content type in your request, it will be resolved:

$ echo 'running' |http httpbin.org/post Content-Type:text/plain

or even with sending compressed content:

$ echo 'running' |gzip |http httpbin.org/post Content-Type:text/plain Content-Encoding:gzip

@WeihanLi
Copy link

You can also use http httpbin.org/post <<< 'raw payload'

seemed not working with powershell, 'rawBody' | http post :8080/api/events worked for me

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

7 participants