|
3 | 3 | <title>Hurl Blog</title> |
4 | 4 | <link href="https://hurl.dev/blog/feed.xml" rel="self" type="application/atom+xml" /> |
5 | 5 | <link href="https://hurl.dev/blog" rel="alternate" type="text/html" /> |
6 | | - <updated>2024-08-29T00:00:00+02:00</updated> |
| 6 | + <updated>2024-12-04T00:00:00+01:00</updated> |
7 | 7 | <id>https://hurl.dev/blog/feed.xml</id> |
| 8 | + <entry> |
| 9 | + <title>Announcing Hurl 6.0.0</title> |
| 10 | + <link href="https://hurl.dev/blog/2024/12/04/announcing-hurl-6.0.0.html" rel="alternate" type="text/html" title="Announcing Hurl 6.0.0"/> |
| 11 | + <published>2024-12-04T00:00:00+01:00</published> |
| 12 | + <updated>2024-12-04T00:00:00+01:00</updated> |
| 13 | + <id>https://hurl.dev/blog/2024/12/04/announcing-hurl-6.0.0.html</id> |
| 14 | + <content type="html"><![CDATA[<h1>Announcing Hurl 6.0.0</h1> |
| 15 | +<div class="blog-post-date">Dec. 04, 2024</div> |
| 16 | +
|
| 17 | +<p>Christmas is early this year: <picture><source srcset="https://hurl.dev/assets/img/emoji-father-christmas.avif" type="image/avif"><source srcset="https://hurl.dev/assets/img/emoji-father-christmas.webp" type="image/webp"><source srcset="https://hurl.dev/assets/img/emoji-father-christmas.png" type="image/png"><img class="emoji" src="https://hurl.dev/assets/img/emoji-father-christmas.png" width="20" height="20" alt="Father Christmas emoji"></picture> the Hurl team is thrilled to announce <a href="https://github.com/Orange-OpenSource/hurl/releases/tag/6.0.0">Hurl 6.0.0</a>!</p> |
| 18 | +<p><a href="https://hurl.dev">Hurl</a> is a command line tool powered by <a href="https://curl.se">curl</a>, that runs HTTP requests defined in a simple plain text format:</p> |
| 19 | +<pre><code class="language-hurl">GET https://example.org/api/tests/4567 |
| 20 | +HTTP 200 |
| 21 | +[Asserts] |
| 22 | +header "x-foo" contains "bar" |
| 23 | +certificate "Expire-Date" daysAfterNow > 15 |
| 24 | +jsonpath "$.status" == "RUNNING" # Check the status code |
| 25 | +jsonpath "$.tests" count == 25 # Check the number of items |
| 26 | +jsonpath "$.id" matches /\d{4}/ # Check the format of the id |
| 27 | +</code></pre> |
| 28 | +<h2>What’s New in This Release</h2> |
| 29 | +<ul> |
| 30 | +<li><a href="#generating-dynamic-values-with-functions">Generating Dynamic Values with Functions</a></li> |
| 31 | +<li><a href="#curl-run-export">curl Run Export</a></li> |
| 32 | +<li><a href="#shorter-syntax-for-sections">Shorter Syntax for Sections</a></li> |
| 33 | +</ul> |
| 34 | +<h2>Generating Dynamic Values with Functions</h2> |
| 35 | +<p>Before 6.0.0, Hurl files could be only <a href="https://hurl.dev/docs/templates.html">templatized</a> with variables. Variables are either injected in the command line, |
| 36 | +in <code>[Options]</code> section or through <a href="https://hurl.dev/docs/capturing-response.html">captures</a>.</p> |
| 37 | +<p>For instance, let’s take this Hurl file:</p> |
| 38 | +<pre><code class="language-hurl">PUT https://example.org/api/hits |
| 39 | +Content-Type: application/json |
| 40 | +{ |
| 41 | + "key0": "{{a_string}}", |
| 42 | + "key1": {{a_bool}}, |
| 43 | + "key2": {{a_null}}, |
| 44 | + "key3": {{a_number}} |
| 45 | +} |
| 46 | +</code></pre> |
| 47 | +<p>When called with these options:</p> |
| 48 | +<pre><code class="language-shell">$ hurl --variable a_string=apple \ |
| 49 | + --variable a_bool=true \ |
| 50 | + --variable a_null=null \ |
| 51 | + --variable a_number=42 \ |
| 52 | + test.hurl |
| 53 | +</code></pre> |
| 54 | +<p>it runs a PUT request with the following JSON body:</p> |
| 55 | +<pre><code>{ |
| 56 | + "key0": "apple", |
| 57 | + "key1": true, |
| 58 | + "key2": null, |
| 59 | + "key3": 42 |
| 60 | +} |
| 61 | +</code></pre> |
| 62 | +<p>With Hurl 6.0.0, we’re introducing <a href="https://hurl.dev/docs/templates.html#functions">functions</a> to generate dynamic values. Current functions are:</p> |
| 63 | +<ul> |
| 64 | +<li><code>newUuid</code> to generate an <a href="https://en.wikipedia.org/wiki/Universally_unique_identifier">UUID v4 random string</a>,</li> |
| 65 | +<li><code>newDate</code> to generate an <a href="https://www.rfc-editor.org/rfc/rfc3339">RFC 3339</a> UTC date string, at the current time.</li> |
| 66 | +</ul> |
| 67 | +<p>In the following example, we use the <code>newDate</code> function to generate a dynamic query parameter:</p> |
| 68 | +<pre><code class="language-hurl">GET https://example.org/api/foo |
| 69 | +[QueryStringParams] |
| 70 | +date: {{newDate}} |
| 71 | +HTTP 200 |
| 72 | +</code></pre> |
| 73 | +<p>We run a <code>GET</code> request to <code>https://example.org/api/foo?date=2024%2D12%2D02T10%3A35%3A44%2E461731Z</code> where the <code>date</code> |
| 74 | +query parameter value is <code>2024-12-02T10:35:44.461731Z</code> URL encoded.</p> |
| 75 | +<p>In this second example, we use the <code>newUuid</code> function to generate an email dynamically:</p> |
| 76 | +<pre><code class="language-hurl">POST https://example.org/api/foo |
| 77 | +{ |
| 78 | + "name": "foo", |
| 79 | + "email": "{{newUuid}}@test.com" |
| 80 | +} |
| 81 | +</code></pre> |
| 82 | +<p>When run, the request body will be:</p> |
| 83 | +<pre><code>{ |
| 84 | + "name": "foo", |
| 85 | + "email": "0531f78f-7f87-44be-a7f2-969a1c4e6d97@test.com" |
| 86 | +} |
| 87 | +</code></pre> |
| 88 | +<p>Functions are a really nice addition to the Hurl file format, we’ve started small with these two functions, but we plan to add many more; don’t hesitate <a href="https://github.com/Orange-OpenSource/hurl/discussions">to open a discussion</a> for |
| 89 | +your use case! </p> |
| 90 | +<h2>curl Run Export</h2> |
| 91 | +<p>In 6.0.0, we have added a new option to help debug and export your Hurl files: with the new [<code>--curl</code> option], we can export |
| 92 | +run files to a list of curl commands. It’s really convenient:</p> |
| 93 | +<pre><code class="language-shell">$ hurl --curl commands.txt *.hurl |
| 94 | +$ cat commands.txt |
| 95 | +curl 'https://google.com' |
| 96 | +curl --head 'https://google.com' |
| 97 | +curl 'https://google.com' |
| 98 | +</code></pre> |
| 99 | +<p>Debug curl command for each request is still available with [<code>--verbose</code>] mode but <code>--curl</code> makes it easy to get instead of |
| 100 | +grepping the standard error.</p> |
| 101 | +<p>Speaking of debug curl command, we have also added it to <a href="https://hurl.dev/docs/running-tests.html#json-report">JSON</a> and <a href="https://hurl.dev/docs/running-tests.html#html-report">HTML report</a>, nice! </p> |
| 102 | +<h2>Shorter Syntax for Sections</h2> |
| 103 | +<p>With this new version, we have made the syntax a little shorter for sections: instead of <code>[QueryStringParams]</code> we can |
| 104 | +use <code>[Query]</code> now, <code>[FormParams]</code> becomes <code>[Form]</code> and <code>[MultipartFormData]</code> becomes <code>[Multipart]</code>. </p> |
| 105 | +<pre><code class="language-hurl">POST https://foo.com/login |
| 106 | +[Form] |
| 107 | +user: alice |
| 108 | +password: secret |
| 109 | +token: 1234578 |
| 110 | +HTTP 302 |
| 111 | +</code></pre> |
| 112 | +<pre><code class="language-hurl">GET https://foo.com/search |
| 113 | +[Query] |
| 114 | +q: Mbappé |
| 115 | +HTTP 200 |
| 116 | +</code></pre> |
| 117 | +<p>Shorter names make a nicer Hurl file and are simpler to remember. We will support longer sections names for a long time |
| 118 | +of course, but we’ll remove them someday! For the moment, documentation is still using longer names and, progressively, |
| 119 | +it will be updated with shorter names.</p> |
| 120 | +<h2>Others</h2> |
| 121 | +<p>In this new version we have implemented two curl options:</p> |
| 122 | +<ul> |
| 123 | +<li><a href="https://hurl.dev/docs/manual.html#limit-rate"><code>--limit-rate</code></a>: limit request to the specified speed in bytes per second. This option is available as a CLI option |
| 124 | +and can be set on a specific request</li> |
| 125 | +<li><a href="https://hurl.dev/docs/manual.html#connect-timeout"><code>--connect-timeout</code></a>: maximum time that connections are allowed to take. This option is set in seconds, but can also |
| 126 | +use <a href="http://hurl.dev/blog/2024/08/29/hurl-5.0.0-the-parallel-edition.html#time-units">time units</a> like <code>10s</code>, <code>20000ms</code> etc...</li> |
| 127 | +</ul> |
| 128 | +<pre><code class="language-hurl">GET https://foo.com |
| 129 | +[Options] |
| 130 | +connect-timeout: 30s |
| 131 | +limit-rate: 32000 |
| 132 | +</code></pre> |
| 133 | +<p>Speaking of CLI options, help in <code>hurl --help</code> has been redesigned and categorized, to make ot a little more readable.</p> |
| 134 | +<p>We have also fixed a lot of bugs: a particular one <a href="https://github.com/Orange-OpenSource/hurl/issues/3297">was a nasty (but rare) bug</a> in our parallel implementation. |
| 135 | +Shout-out to <a href="https://www.lambrospetrou.com">Lambros Petrou</a> for having identified this one: TLDR, don’t exit a main entry point program when there |
| 136 | +are still living threads... Lambros is the mind behind <a href="https://www.skybear.net">Skybear.NET</a>, a managed platform to automate HTTP API |
| 137 | +testing. Give it a try, it’s really powerful, simple and super cool (besides using Hurl of course!)</p> |
| 138 | +<p>There are a lot of other improvements with Hurl 6.0.0 and also a lot of bug fixes, you can check the complete list of |
| 139 | +enhancements and bug fixes <a href="https://github.com/Orange-OpenSource/hurl/releases/tag/6.0.0">in our release note</a>.</p> |
| 140 | +<p>If you like Hurl, don’t hesitate to <a href="https://github.com/Orange-OpenSource/hurl/stargazers">give us a star on GitHub</a> or share it on <a href="https://x.com/HurlDev">𝕏 / Twitter</a>!</p> |
| 141 | +<p>We’ll be happy to hear from you, either for enhancement requests or for sharing your success story using Hurl!</p>]]></content> |
| 142 | + <author> |
| 143 | + <name/> |
| 144 | + </author> |
| 145 | + <summary>the Hurl team is thrilled to announce Hurl 6.0.0</summary> |
| 146 | + </entry> |
8 | 147 | <entry> |
9 | 148 | <title>Hurl 5.0.0, the Parallel Edition</title> |
10 | 149 | <link href="https://hurl.dev/blog/2024/08/29/hurl-5.0.0-the-parallel-edition.html" rel="alternate" type="text/html" title="Hurl 5.0.0, the Parallel Edition"/> |
|
0 commit comments