Skip to content

-d does not imply POST, but its help text claims it does #28

Description

@korya

Problem

The -d flag description is copied from curl:

-d, --data string   Sends the specified data in a POST request to the HTTP server

But unlike curl, the method is not switched — it stays GET unless -X is passed.

Reproduction

$ http-assert -d 'hello=1' --assert-ok http://127.0.0.1:8791/echo
[.] HTTP/1.1 GET http://127.0.0.1:8791/echo          ← GET, with a body
…
{"method": "GET", "body": "hello=1", …}

Why it matters

A GET with a request body is legal but almost never what the user meant, and the help text actively promises otherwise.

Suggested fix

Pick one and make the docs match:

  1. Match curl — default the method to POST when -d is supplied and -X is not; or
  2. Keep the current behaviour and fix the help text to Send the specified data as the request body.

Option 1 matches user expectation; option 2 is the smaller change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions