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

Using HTTPIE with GNU Parallel #359

Closed
CMCDragonkai opened this issue Jun 1, 2015 · 1 comment
Closed

Using HTTPIE with GNU Parallel #359

CMCDragonkai opened this issue Jun 1, 2015 · 1 comment

Comments

@CMCDragonkai
Copy link

This works:

seq 1 | parallel -n0 "curl -H 'Content-Type: application/json' http://httpbin.org/post -X POST -d '{\"url\":\"http://google.com/\"}'"

But this doesn't:

seq 1 | parallel -n0 "http POST http://httpbin.org/post url=http://google.com/"

The result is:

http: error: Request body (from stdin or a file) and request data (key=value) cannot be mixed.

It seems that by using a pipe with parallel, httpie is thinking that it's meant to take data from stdin/file, and won't take in the command like request data.

The -n0 command makes parallel not pass any parameters to the command.

@jkbrzt
Copy link
Member

jkbrzt commented Jun 1, 2015

You can use --ignore-stdin to tell HTTPie to not read from standard input even though it's redirected:

$ seq 1 | parallel -n0 "http --ignore-stdin httpbin.org/post url=http://google.com/"

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

@jkbrzt jkbrzt closed this as completed Jun 1, 2015
@jkbrzt jkbrzt added the question label Jun 1, 2015
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

2 participants