httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
32.67k stars 3.68k forks source link

HTTPie could be lead to believe data was passed in stdin when it was not #1551

Open Ousret opened 5 months ago

Ousret commented 5 months ago

Minimal reproduction code and steps

FROM python:3.11

RUN pip install httpie
$ docker build -t httpie .
$ docker run httpie https pie.dev/get

Current result

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>405 Method Not Allowed</title>
<h1>Method Not Allowed</h1>
<p>The method is not allowed for the requested URL.</p>

Expected result

Well, not sending a POST request.


The condition, that verify stdin data is insufficient, unfortunately. Containerized environments seems to be the most concerned at the time. Due to the missing "interactive" mode.

# see argparser.py
self.has_stdin_data = (
    self.env.stdin
    and not self.args.ignore_stdin
    and not self.env.stdin_isatty
)

A fix has been created.

Ousret commented 5 months ago

Additional evidences https://github.com/Ousret/httpie-test/actions/runs/7470321266/job/20328824310