News for hackers. Stuff that matters.
Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by jicea on Tuesday October 05, 2021 @08:02AM (#28758227)
We're releasing a new version of Hurl, a simple HTTP cli tool built on top of libcurl and Rust.

Hurl 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.

An Hurl sample:

  GET https//example.org/books
  
  HTTP/1.1 200
  [Asserts]
  jsonpath "$.validated" == true
  jsonpath "$.books" count == 12
  jsonpath "$.books[2].name" == "Dune"
Since our first "Show HN" submission [1], we have made the following changes:

- full native support on Windows

- improve Hurl file format syntax (with md5, sha1, sha256 asserts for instance)

- add a tutorial on how to use Hurl [2]

- add a simple interactive mode

- a lot of bug fixes!

In our roadmap, we want to have a better support for package manager (brew, apt etc...), better error feedbacks.

We're looking for contributions on improving/correcting our documentation, build an UI client above Hurl, better IDE tooling integration.

And last but not least, we would be happy to have feeback on it!

[1] https://news.ycombinator.com/item?id=25655737

[2] https://hurl.dev/docs/tutorial/your-first-hurl-file.html

Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by woile on Tuesday October 05, 2021 @09:13AM (#28758928)
This looks really cool! Very promising!

Is it possible to chain a value from a response to the next request? This would be useful for testing.

My understand is that between the header and the body there has to be a new line[0], in the docs seems like it's skipped[1], does it affect functionality if skipped? or is it intentional?

Thanks!

[0]: https://www.lifewire.com/hypertext-transfer-protocol-817944 [1]: https://hurl.dev/index.html#also-an-http-test-tool

Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by fabricereix on Tuesday October 05, 2021 @09:34AM (#28759233)
Yes, this is possible to chain a value from a response to the next request. The value is extracted and stored in a variable. This variable can be reused afterward.

    # Get home:
    GET https://example.net
    
    HTTP/1.1 200
    [Captures]
    csrf_token: xpath "string(//meta[@name='_csrf_token']/@content)"
    
    # Do login!
    POST https://example.net/login?user=toto&password=1234
    X-CSRF-TOKEN: {{csrf_token}}
    
    HTTP/1.1 302
Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by maverwa on Tuesday October 05, 2021 @08:47AM (#28758638)
Looks like something we could actually use for some API smoke tests. I'll bookmark it, thank you!
Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by certifiedloud on Tuesday October 05, 2021 @09:37AM (#28759263)
The first feature I look for in tools like this is the ability to run requests concurrently. Of course some requests depend on others, but there are often a lot of requests that can be run concurrently to save time. I don't see how to do that with hurl.
Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by fabricereix on Tuesday October 05, 2021 @09:59AM (#28759588)
This is not possible yet.

We have related issues: - https://github.com/Orange-OpenSource/hurl/issues/87 - https://github.com/Orange-OpenSource/hurl/issues/88

Running several Hurl files concurrently (and independently) is clear and we will probably add in the next few months.

Running requests concurrently in the same Hurl file will be more complicated. The Hurl language has to describe a clear semantic about it.

Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by nonameiguess on Tuesday October 05, 2021 @01:45PM (#28762858)
Can you read a request from stdin? It could just be catted through GNU parallel to launch many hurls concurrently.
Re:Show HN: Hurl – Run and test HTTP requests with plain tex... by fabricereix on Wednesday October 06, 2021 @07:17AM (#28771702)
Yes you can.

    $ echo GET http://google.com | hurl
    <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
    <TITLE>301 Moved</TITLE></HEAD><BODY>
    <H1>301 Moved</H1>
    The document has moved
    <A HREF="http://www.google.com/">here</A>.
    </BODY></HTML>