Open talis-fb opened 6 months ago
The objective is to replicate this feature in HTTPie: https://httpie.io/docs/cli/redirected-input
Accept user for passing request data is through redirected stdin (standard input)—piping. Receiving the inputs from this method is similar to using --raw flag with the content passed in stdin.
--raw
treq PUT api.com/put < files/data.json
echo -n '{"name": "John"}' | http PATCH api.com/patch Auth:None
These three command are equivalent (consider the file.json with content as {"name": "Thales"})
{"name": "Thales"}
treq POST api.com/post --raw '{"name": "Thales"}' echo '{"name": "Thales"}' | treq POST api.com/post treq POST api.com/post < file.json cat file.json | treq POST api.com/post
It's really important use the same abstraction used by --raw flag. That way is even possible to merge the input from this with request items.
This command
echo '{ "name": "John", "age": 21 }' | treq POST api.com/post job=dev role=admin
would request with body...
{ "name": "John", "age": 21, "job": "dev", "role": "admin" }
The objective is to replicate this feature in HTTPie: https://httpie.io/docs/cli/redirected-input
Accept user for passing request data is through redirected stdin (standard input)—piping. Receiving the inputs from this method is similar to using
--raw
flag with the content passed in stdin.These three command are equivalent (consider the file.json with content as
{"name": "Thales"}
)Additional Considerations:
It's really important use the same abstraction used by
--raw
flag. That way is even possible to merge the input from this with request items.This command
would request with body...