Add option to ignore stdin data
See original GitHub issuehttp: error: Request body (from stdin or a file) and request data (key=value) cannot be mixed.
This error is rather cryptic. I’m writing a shell script to interact with a rest API, and I’m doing this:
http --output subnet --pretty format --form post "${URLHOST}subnets" "cidr=${cidr}" "name=${name}" "description=${name}" "availabilityZoneId=${az}" "networkId=${VPCid}" "$ACCESSKEY" "$SECRETKEY" "$ACCOUNTID" "_providerId=aws" "_regionId=${REGION}"
Which produces (when preceded by ‘echo’ a command that works perfectly well. However, this version gives the error in the subject.
Am I being stupid, or is this something else?
FYI: The result of the above is as followed (sanitized slightly)
http --output subnet --pretty format --form post https://test.grid.domain.com/subnets cidr=10.124.33.128/25 name=Load_balancers description=Load_balancers availabilityZoneId=us-east-1c networkId=vpc-31433e7e x-gridauth-accesskey:DOYOUNEEDTOKNOW x-gridauth-secretaccesskey:WHATISWITHALLTHEQUESTIONS x-gridauth-accountid:11223344556677 _providerId=aws _regionId=us-east-1
Issue Analytics
- State:
- Created 10 years ago
- Reactions:5
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Add option to ignore stdin data · Issue #150 · httpie ... - GitHub
http: error: Request body (from stdin or a file) and request data (key=value) cannot be mixed. This error is rather cryptic. I'm writing...
Read more >How do I ignore stdin with `xargs`? [duplicate] - Stack Overflow
I'm using xargs + seq to run a command several thousand times in parrallel. However xargs is appending the output of stdin to...
Read more >How to signal the end of stdin input - Unix Stack Exchange
The simple, non-technical, answer is that Ctrl + D terminates the STDIN file and that Ctrl + C terminates the active application. Both...
Read more >Full Listing of Options and Their Descriptions - Flake8
The difference to the --ignore option is, that this option can be used to selectively add individual codes without overriding the default list...
Read more >borg create — Borg - Deduplicating Archiver 1.2.2 ...
Reading from stdin yields just a stream of data without file metadata associated with it, and the files cache is not needed at...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For future reference, there now is a CLI argument
--ignore-stdin
that can be used to explicitly tell HTTPie that request data (key=value) should be preferred over request body (from stdin).Cf. https://httpie.org/docs#redirected-input
I see, the problem is that in the loop context HTTPie inherits its
STDIN
(which is redirected).You should be able to work it around by changing HTTPie’s
STDIN
back to the terminal input (< /dev/tty
):