davecheney / httpstat

It's like curl -v, with colours.
MIT License
6.96k stars 382 forks source link

Support for @filename in -d parameter #46

Closed lucindo closed 7 years ago

lucindo commented 7 years ago

Hi,

curl(1) let you post data from files using -d @filename. I use it all the time missed this feature when working with httpstat.

If you think this is a relevant addition I can make a pull request.

The changes I made for this to work are here: https://github.com/lucindo/httpstat/commit/87c4d32f548248dcbe11d3501b4ed706656474fe

davecheney commented 7 years ago

Sounds good to me, please be aware of the other PR's in flight such as #35 and #20.

mibk commented 7 years ago

If implemented, shouldn't there be a way to avoid the special interpretation of @ character. If I look at curl(1), there's a few alternatives to -d:

Where --data-raw is the one to avoid that. Also being able to urlencode parameters before posting could be useful as well.

According to the manual, using -d also sets Content-Type to application/x-www-form-urlencoded. And using -d implies POST method if none is set.

davecheney commented 7 years ago

Urgh. I'm starting to change my mind here, I don't want all those flags, the combinational explosion of their interactions means having to write a functional test harness, rather that the nice simple "did it work or did it fail" tests we have now.

-d @filename is the limit, no more. Thank you.

If you need more than that you'll have to explain why you cannot just use curl instead.