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
33.22k stars 3.67k forks source link

PUT without key? #232

Closed andyshinn closed 10 years ago

andyshinn commented 10 years ago

Is there a way to PUT without having to specify a key?

In curl I often use the following to test sending data to my application:

$ curl -X PUT -d "random_string" myapp.mydomain.com/hello

But this is invalid syntax in HTTPie:

$ http PUT http://myapp.mydomain.com/hello random_string
usage: http [--json] [--form] [--pretty {all,colors,format,none}]
            [--style STYLE] [--print WHAT] [--verbose] [--headers] [--body]
            [--stream] [--output FILE] [--download] [--continue]
            [--session SESSION_NAME_OR_PATH | --session-read-only SESSION_NAME_OR_PATH]
            [--auth USER[:PASS]] [--auth-type {basic,digest}]
            [--proxy PROTOCOL:PROXY_URL] [--follow] [--verify VERIFY]
            [--timeout SECONDS] [--check-status] [--ignore-stdin] [--help]
            [--version] [--traceback] [--debug]
            [METHOD] URL [REQUEST_ITEM [REQUEST_ITEM ...]]
http: error: argument REQUEST_ITEM: "random_string" is not a valid value

Am I missing an option to support this behavior? If not, consider this a feature request to support PUT and POST without a key.

jkbrzt commented 10 years ago

@andyshinn In HTTPie this done via stdin:

$ echo "random_string" |  http PUT myapp.mydomain.com/hello

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

andyshinn commented 10 years ago

Gotcha, thank you for this great tool!