4 ms·
Show HN: Hurl – Run and test HTTP requests
- jicea 6y agoHurl is a simple http client built on top of libcurl with Rust. It allows running http requests defined in a plain text format. It can be used to fetch data, or play a scenario (sequence of requests), asserting responses along the way. With its textual format, it is aimed for both devops and developers. With its command-line usage/simple unique binary, it is aimed for both local dev and continuous integration. We've build Hurl to address our needs of integration tests. We've tried various solutions but all were flawed in some ways: difficult to integrate in a CI, not reliable etc... At the end of the day, we just wanted curl with the possibility to add tests, so we build it. We're using Hurl in our CI/CD from more than one year and are very happy with it! Currently, releases are available for both Linux and macOS. Though we would like to add more features, our main objective is to keep it small, fast and simple. Let us know what you think!
- miccah 6y agoThis looks really great. I like that everything is defined in plaintext, but is there a way to link in other files? It might help clear up some clutter for large payloads. Environment variables might be good for using secrets more securely as well. I'm actually working on a similar project (also in Rust) but targeting interactive use and differing environments. It's a tool I created for myself because I was tired of hand crafting curl commands and forgetting which env variables are set to what. It is still very young but I'll link it anyway: https://github.com/mcastorina/repost https://github.com/mcastorina/repost
- jicea 6y agoThanks for the feedbacks! Looking at repost, I can see that there is definitely a place for an HTTP runner/tools that can do asserts on response. For your suggestions, environnement variable support is certainly a good feature (actually, we can inject variable in the command line ex: hurl --variable user=dude file.hurl). Including another file is also a good suggestion. Currently we write tests by hand or sometimes generate the Hurl text file when we want to reuse steps, but a build-in support is a good idea.
- fabricereix 6y agoWe have the option to include a body from an external file, this is especially useful for large or binary payload. POST https://example.net file,data.bin;
- bhargav 6y agoI suggest adding an interactive mode! Aside: I tried to go through the samples and was having trouble running them successfully.
- jicea 6y agoYes interactive mode is a must have. For the sample, maybe this is not obvious but you have to write the sample in a text file: $ vi test.hurl GET https://news.ycombinator.com HTTP/1.1 200 And then use this file with Hurl: $ hurl test.hurl
- bhargav 6y agoYeah I saw the file option. I think it will be nifty when we have to do large request payloads, but ideally for example the sample, `echo GET http://httpbin.org/get http://httpbin.org/get | hurl` we could do something like: `hurl -i echo GET http://httpbin.org/get http://httpbin.org/get`. I understand its a bit subjective :)
- fabricereix 6y agoWe are planning the possibility to stop between requests with an inspection mode. We would also love an ncurse interface, like mitmproxy.
- hstan4 6y agoTypo on the menu bar: “Man Page” instead of “Main Page”
- jicea 6y agoNo, it’s really the output of: man hurl :) But as English is not our primary language, there must be a lot of typo/bad English
- taf2 6y agoI love it reminds of hurl.it - pretty sure it’s not online anymore due to abuse, but very handy.