5 ms·
Is there a command line tool or editor plugin where I don't have to specify parameters, learn all the options. Instead I would just point it to an "http file" w
by dsego 5y ago
Is there a command line tool or editor plugin where I don't have to specify parameters, learn all the options. Instead I would just point it to an "http file" with http syntax and it "runs" it. Meaning the file contents are the http request that I want to send, eg
GET / HTTP/1.1
Cookie:
Accept: text/html,...
Host: news.ycombinator.com
Accept-Language: en-GB,en;q=0.9
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
And the I can just run it like so `http myRequest.http`
There are some decade old sublime text plugins that claim to do this, but none of them seem to work anymore, from what I'm seeing.
- iib 5y agoEmacs can do this [1]. AFAIK, this is what inspired the vscode extension. [1] https://github.com/pashky/restclient.el https://github.com/pashky/restclient.el
- SixDouble5321 5y agoHttpie is what I use for this. I use shell scripts, with httpie commands which look very much like http syntax. https://github.com/httpie/httpie https://github.com/httpie/httpie
- cbcoutinho 5y agoYes this exists as a VS code plugin https://marketplace.visualstudio.com/items?itemName=humao.rest-client https://marketplace.visualstudio.com/items?itemName=humao.re...
- andiareso 5y agoSecond this one :D
- deleted 5y ago[deleted]
- Extropy_ 5y agoI know IntelliJ IDEA Ultimate does that, not sure about any CLI tools. But it does look like you could use netcat to do that, for example: cat myRequest.http | netcat example.com 80
- seanw444 5y agoEmacs has a handy plugin for exactly that. https://github.com/pashky/restclient.el https://github.com/pashky/restclient.el
- User23 5y agoThere are also good options for GraphQL. I particularly like embedding the calls in org mode[1]. There's similar functionality for REST[2]. [1] https://github.com/jdormit/ob-graphql https://github.com/jdormit/ob-graphql [2] https://github.com/alf/ob-restclient.el https://github.com/alf/ob-restclient.el
- WaxProlix 5y agoCan't `nc` (netcat) do (basically) this? `cat myRequest.http | nc <hostname> <port>` Not robust, but it comes with all systems for free.
- matt_heimer 5y agoFrom a CLI you run into issues with `nc` and the like supporting https. You can get close with `curl` since it has a -H option that allows you to provide headers in a file. curl -v -H @request1.txt neverssl.com With a request1.txt header file X-Header: mine User-Agent: bob Will generate a request of > GET / HTTP/1.1 > Host: neverssl.com > Accept: */* > X-Header: mine > User-Agent: bob You end up needing to know 3 options. -X <METHOD> to specify the HTTP method, -d @<file> if you want to send a request body, and -H.
- eriol 5y agoYou may want to look at hurl: https://hurl.dev/ https://hurl.dev/
- mnembrini 5y agoYou want this https://github.com/bayne/dot-http https://github.com/bayne/dot-http
- smusamashah 5y agoYou may also want to look at Prestige https://prestigemad.com/ https://prestigemad.com/ https://news.ycombinator.com/item?id=27412445 https://news.ycombinator.com/item?id=27412445
- sharat87 5y agoHey! Author here. Thanks for sharing. Happy to answer any questions about this here. :)
- hultner 5y agoYeah, nc 80. Or openssl s_client for https, you can also run through stunnel.