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
Advanced stdin processing #194
Comments
Interesting. Current master allows you to specify file contents as values for fields (via $ http --version
0.8.0-dev $ http -v httpbin.org/post stdin_data=@/dev/stdin
Hello World
^D POST /post HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 31
Content-Type: application/json; charset=utf-8
Host: httpbin.org
User-Agent: HTTPie/0.8.0-dev
{
"stdin_data": "Hello World\n"
}
… It currently has the limitation that HTTPie doesn't allow you to specify both request data items on the CLI and pass content via $ echo 'Hello World' | http httpbin.org/post stdin_data=@/dev/stdin
http: error: Request body (from stdin or a file) and request data (key=value) cannot be mixed.
|
Just wondering: when do you actually use this feature? |
I didn't think of /dev/stdin for an @ file value. Nice idea. My use case is, as said above, http://sprunge.us. To be more specific, I wanted to paste a couple of lines from vim, which I normally do like this:
|
Oh, that's interesting. It seems to work pretty well: :! http -f sprunge.us sprunge=@/dev/stdin
<paste>
^D Or, send the content of the current file: :! http -f sprunge.us sprunge=@% |
Great! The /dev/stdin trick is kind of a stretch though. Some kind of shorthand like curl has would be nice. field=@- or something like that. Thanks for the quick reply, I'll be waiting for a 0.8.0 release, then :) |
Hi, I came across this because I was also attempting to use the sprunge.us service with httpie, but not from within vim. Could this be reopened? Passing data via a pipe still doesn't work.
|
This is now being worked on here: #370 |
I also would like this feature. I'm grabbing a CSV, posting it to a service, altering the CSV using csvkit, and then want to post the altered version to a service again:
It would be nice to have been able to use |
Agreed, @jaraco |
Hey there,
I am missing a feature to pass a file as a post field from stdin. My particular use case is this from curl:
command | curl -F 'sprunge=<-' http://sprunge.us
which I noticed is not possible with httpie.
If it's not too much trouble, I would kindly like to request this feature.
The text was updated successfully, but these errors were encountered: