Announcing Hurl 1.6.0

The Hurl team is happy to announce a new version of Hurl, 1.6.0.

Hurl is a command line tool powered by curl, that runs HTTP requests defined in a simple plain text format:

# Get home:
GET https://example.org

HTTP/1.1 200
[Captures]
csrf_token: xpath "string(//meta[@name='_csrf_token']/@content)"

# Do login!
POST https://example.org/login?user=toto&password=1234
X-CSRF-TOKEN: 

HTTP/1.1 302

So, what’s new in 1.6.0?

Simplify basic authentication

Before 1.6.0, basic authentication could be achieved by computing and sending an Authorization header:

# Authorization header value can be computed with:
# `echo -n 'bob:secret' | base64`
GET https://example.org/protected
Authorization: Basic Ym9iOnNlY3JldA==

In 1.6.0, we’ve introduced a basic authentication section to pass username/password explicitly, without base64 encoding:

GET https://example.org/protected
[BasicAuth]
bob: secret

Basic authentication allows per request authentication. If you want to add basic authentication to all the request of a Hurl file you could use -u/--user option.

Regex literal

matches predicates values are regex. Before 1.6.0, metacharacters in pattern values should be escaped (like \d etc...):

GET https://sample.org/hello

HTTP/1.0 200
[Asserts]
jsonpath "$.date" matches "^\\d{4}-\\d{2}-\\d{2}$"
jsonpath "$.name" matches "Hello [a-zA-Z]+!"

In 1.6.0, we’ve added regex literal for matches:

GET https://sample.org/hello

HTTP/1.0 200
[Asserts]
jsonpath "$.date" matches /^\d{4}-\d{2}-\d{2}$/
jsonpath "$.name" matches /Hello [a-zA-Z]+!/

The new asserts are much more readable and easier to write.

Basic authentication section and regex literal has been suggested to us by David Humphrey so thanks again David for your ideas!

Interactive mode improvements

In interactive mode, Hurl plays each request and pauses between each entry, allowing to debug a session step by step. We’ve improved the interactive mode to display the next request to be played:

...
< Last-Modified: Fri, 11 Feb 2022 13:28:20 GMT
< Connection: keep-alive
< ETag: "62066474-6f02"
< Accept-Ranges: bytes
< 
* 

interactive mode

next request:

GET https://hurl.dev/docs/manual.html

Press Q (Quit) or C (Continue)

Other changes

Under the hood, we’ve improved our code and Hurl should be quicker than ever. There are other changes and bug fixes in the Hurl 1.6.0 release: check out the release note!

If you like Hurl, don’t hesitate to give us a star!

And, finally, a big thanks to all our contributors!