You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for this utility! Has made requesting/testing URLs in development very handy for me.
I came across a bug that was resolved by using the instructions in #150 and #660 , but I am seeing unexpected behavior in the request itself that I couldn't find in reported in another issue.
When parsing a URL from a pipe, I expected httpie to create a GET request to the specified URL:
Translates to: http https://api.weather.gov/gridpoints/LOT/65,76/forecast
When I run the piped request, the URL returns 403 Forbidden, indicating an unauthorized request. Running the request with debug indicates I've sent a POST method to the URL (Refer to requests.request section)
Hi @webdog! xargs doesn’t use /dev/tty for the child’s stdin by default. Therefore, HTTPie will read data from stdin and assume you’re trying to send some data (even if it’s just '' — this might change in a future version), and default to a POST request.
The most straightforward solution is to use the already mentioned --ignore-stdin even here:
$ echo pie.dev/get | xargs http --ignore-stdin
Another option would be to use xargs -o:
$ echo pie.dev/get | xargs -o http
$ man xargs
…
-o Reopen stdin as /dev/tty in the child process before executing the command.
This is useful if you want xargs to run an interactive application.
…
Hello!
Thank you for this utility! Has made requesting/testing URLs in development very handy for me.
I came across a bug that was resolved by using the instructions in #150 and #660 , but I am seeing unexpected behavior in the request itself that I couldn't find in reported in another issue.
When parsing a URL from a pipe, I expected httpie to create a GET request to the specified URL:
http https://api.weather.gov/points/41.9752,-87.9035 | jq '.properties.forecast | tostring' | sed 's/"//g' | xargs http
Translates to:
http https://api.weather.gov/gridpoints/LOT/65,76/forecast
When I run the piped request, the URL returns 403 Forbidden, indicating an unauthorized request. Running the request with debug indicates I've sent a POST method to the URL (Refer to requests.request section)
By appending
--ignore-stdin
to the request URL, or by declaring GET as the method in the first argument following http maintains the request as a GET:The text was updated successfully, but these errors were encountered: