Skip to content

Commit ccc4124

Browse files
authored
Add Hurl 6.0.0 blog post. (#100)
1 parent 2611df3 commit ccc4124

7 files changed

Lines changed: 358 additions & 5 deletions

sites/hurl.dev/_docs/templates.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ jsonpath "$.errors[{{index}}].id" == "error"
5454

5555
Besides variables, functions can be used to generate dynamic values. Current functions are:
5656

57-
| Function | Description |
58-
|-----------|-------------------------------------------------------------|
59-
| `newUuid` | Generates an [UUID v4 random string] |
60-
| `newDate` | Generates a [RFC 3339] UTC date string, at the current time |
57+
| Function | Description |
58+
|-----------|--------------------------------------------------------------|
59+
| `newUuid` | Generates an [UUID v4 random string] |
60+
| `newDate` | Generates an [RFC 3339] UTC date string, at the current time |
6161

6262
In the following example, we use `newDate` to generate a dynamic query parameter:
6363

sites/hurl.dev/_posts/2024-08-29-hurl-5.0.0-the-parallel-edition.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ We'll be happy to hear from you, either for enhancement requests or for sharing
316316
[multiline body assertions]: {% link _docs/asserting-response.md %}#multiline-string-body
317317
[Java getRandom method]: https://issues.apache.org/jira/browse/LANG-1748
318318
[--repeat option]: {% link _docs/manual.md %}#repeat
319+
[`--repeat`]: {% link _docs/manual.md %}#repeat
319320
[--report-json]: {% link _docs/manual.md %}#report-json
320321
[in our release note]: https://github.com/Orange-OpenSource/hurl/releases/tag/5.0.0
321322
[Twitter]: https://x.com/HurlDev
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
---
2+
title: Announcing Hurl 6.0.0
3+
layout: blog
4+
section: Blog
5+
permalink: /blog/:year/:month/:day/:title.html
6+
---
7+
8+
# {{ page.title }}
9+
10+
<div class="blog-post-date">{{ page.date | date: "%b. %d, %Y" }}</div>
11+
12+
Christmas is early this year: <picture><source srcset="{{ '/assets/img/emoji-father-christmas.avif' | prepend:site.baseurl }}" type="image/avif"><source srcset="{{ '/assets/img/emoji-father-christmas.webp' | prepend:site.baseurl }}" type="image/webp"><source srcset="{{ '/assets/img/emoji-father-christmas.png' | prepend:site.baseurl }}" type="image/png"><img class="emoji" src="{{ '/assets/img/emoji-father-christmas.png' | prepend:site.baseurl }}" width="20" height="20" alt="Father Christmas emoji"></picture> the Hurl team is thrilled to announce [Hurl 6.0.0]!
13+
14+
[Hurl] is a command line tool powered by [curl], that runs HTTP requests defined in a simple plain text format:
15+
16+
```hurl
17+
GET https://example.org/api/tests/4567
18+
HTTP 200
19+
[Asserts]
20+
header "x-foo" contains "bar"
21+
certificate "Expire-Date" daysAfterNow > 15
22+
jsonpath "$.status" == "RUNNING" # Check the status code
23+
jsonpath "$.tests" count == 25 # Check the number of items
24+
jsonpath "$.id" matches /\d{4}/ # Check the format of the id
25+
```
26+
27+
## What’s New in This Release
28+
29+
- [Generating Dynamic Values with Functions](#generating-dynamic-values-with-functions)
30+
- [curl Run Export](#curl-run-export)
31+
- [Shorter Syntax for Sections](#shorter-syntax-for-sections)
32+
33+
## Generating Dynamic Values with Functions
34+
35+
Before 6.0.0, Hurl files could be only [templatized] with variables. Variables are either injected in the command line,
36+
in `[Options]` section or through [captures].
37+
38+
For instance, let's take this Hurl file:
39+
40+
{% raw %}
41+
```hurl
42+
PUT https://example.org/api/hits
43+
Content-Type: application/json
44+
{
45+
"key0": "{{a_string}}",
46+
"key1": {{a_bool}},
47+
"key2": {{a_null}},
48+
"key3": {{a_number}}
49+
}
50+
```
51+
{% endraw %}
52+
53+
When called with these options:
54+
55+
```shell
56+
$ hurl --variable a_string=apple \
57+
--variable a_bool=true \
58+
--variable a_null=null \
59+
--variable a_number=42 \
60+
test.hurl
61+
```
62+
63+
it runs a PUT request with the following JSON body:
64+
65+
```
66+
{
67+
"key0": "apple",
68+
"key1": true,
69+
"key2": null,
70+
"key3": 42
71+
}
72+
```
73+
74+
75+
With Hurl 6.0.0, we're introducing [functions] to generate dynamic values. Current functions are:
76+
77+
- `newUuid` to generate an [UUID v4 random string],
78+
- `newDate` to generate an [RFC 3339] UTC date string, at the current time.
79+
80+
In the following example, we use the `newDate` function to generate a dynamic query parameter:
81+
82+
{% raw %}
83+
```hurl
84+
GET https://example.org/api/foo
85+
[QueryStringParams]
86+
date: {{newDate}}
87+
HTTP 200
88+
```
89+
{% endraw %}
90+
91+
We run a `GET` request to `https://example.org/api/foo?date=2024%2D12%2D02T10%3A35%3A44%2E461731Z` where the `date`
92+
query parameter value is `2024-12-02T10:35:44.461731Z` URL encoded.
93+
94+
In this second example, we use the `newUuid` function to generate an email dynamically:
95+
96+
{% raw %}
97+
```hurl
98+
POST https://example.org/api/foo
99+
{
100+
"name": "foo",
101+
"email": "{{newUuid}}@test.com"
102+
}
103+
```
104+
{% endraw %}
105+
106+
When run, the request body will be:
107+
108+
```
109+
{
110+
"name": "foo",
111+
"email": "0531f78f-7f87-44be-a7f2-969a1c4e6d97@test.com"
112+
}
113+
```
114+
115+
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 [to open a discussion] for
116+
your use case!
117+
118+
## curl Run Export
119+
120+
In 6.0.0, we have added a new option to help debug and export your Hurl files: with the new [`--curl` option], we can export
121+
run files to a list of curl commands. It's really convenient:
122+
123+
```shell
124+
$ hurl --curl commands.txt *.hurl
125+
$ cat commands.txt
126+
curl 'https://google.com'
127+
curl --head 'https://google.com'
128+
curl 'https://google.com'
129+
```
130+
131+
Debug curl command for each request is still available with [`--verbose`] mode but `--curl` makes it easy to get instead of
132+
grepping the standard error.
133+
134+
Speaking of debug curl command, we have also added it to [JSON] and [HTML report], nice!
135+
136+
## Shorter Syntax for Sections
137+
138+
With this new version, we have made the syntax a little shorter for sections: instead of `[QueryStringParams]` we can
139+
use `[Query]` now, `[FormParams]` becomes `[Form]` and `[MultipartFormData]` becomes `[Multipart]`.
140+
141+
```hurl
142+
POST https://foo.com/login
143+
[Form]
144+
user: alice
145+
password: secret
146+
token: 1234578
147+
HTTP 302
148+
```
149+
150+
```hurl
151+
GET https://foo.com/search
152+
[Query]
153+
q: Mbappé
154+
HTTP 200
155+
```
156+
157+
Shorter names make a nicer Hurl file and are simpler to remember. We will support longer sections names for a long time
158+
of course, but we'll remove them someday! For the moment, documentation is still using longer names and, progressively,
159+
it will be updated with shorter names.
160+
161+
## Others
162+
163+
In this new version we have implemented two curl options:
164+
165+
- [`--limit-rate`][limit-rate]: limit request to the specified speed in bytes per second. This option is available as a CLI option
166+
and can be set on a specific request
167+
- [`--connect-timeout`][connect-timeout]: maximum time that connections are allowed to take. This option is set in seconds, but can also
168+
use [time units] like `10s`, `20000ms` etc...
169+
170+
```hurl
171+
GET https://foo.com
172+
[Options]
173+
connect-timeout: 30s
174+
limit-rate: 32000
175+
```
176+
177+
Speaking of CLI options, help in `hurl --help` has been redesigned and categorized, to make ot a little more readable.
178+
179+
We have also fixed a lot of bugs: a particular one [was a nasty (but rare) bug] in our parallel implementation.
180+
Shout-out to [Lambros Petrou] for having identified this one: TLDR, don't exit a main entry point program when there
181+
are still living threads... Lambros is the mind behind [Skybear.NET], a managed platform to automate HTTP API
182+
testing. Give it a try, it's really powerful, simple and super cool (besides using Hurl of course!)
183+
184+
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
185+
enhancements and bug fixes [in our release note].
186+
187+
If you like Hurl, don't hesitate to [give us a star on GitHub] or share it on [𝕏 / Twitter]!
188+
189+
We'll be happy to hear from you, either for enhancement requests or for sharing your success story using Hurl!
190+
191+
192+
[Hurl 6.0.0]: https://github.com/Orange-OpenSource/hurl/releases/tag/6.0.0
193+
[Hurl]: https://hurl.dev
194+
[curl]: https://curl.se
195+
[functions]: {% link _docs/templates.md %}#functions
196+
[UUID v4 random string]: https://en.wikipedia.org/wiki/Universally_unique_identifier
197+
[RFC 3339]: https://www.rfc-editor.org/rfc/rfc3339
198+
[templatized]: {% link _docs/templates.md %}
199+
[captures]: {% link _docs/capturing-response.md %}
200+
[in our release note]: https://github.com/Orange-OpenSource/hurl/releases/tag/6.0.0
201+
[𝕏 / Twitter]: https://x.com/HurlDev
202+
[give us a star on GitHub]: https://github.com/Orange-OpenSource/hurl/stargazers
203+
[to open a discussion]: https://github.com/Orange-OpenSource/hurl/discussions
204+
[`--curl` option]: {% link _docs/manual.md %}#curl
205+
[`--verbose`]: {% link _docs/manual.md %}#verbose
206+
[JSON]: {% link _docs/running-tests.md %}#json-report
207+
[HTML report]: {% link _docs/running-tests.md %}#html-report
208+
[Lambros Petrou]: https://www.lambrospetrou.com
209+
[Skybear.NET]: https://www.skybear.net
210+
[limit-rate]: {% link _docs/manual.md %}#limit-rate
211+
[connect-timeout]: {% link _docs/manual.md %}#connect-timeout
212+
[was a nasty (but rare) bug]: https://github.com/Orange-OpenSource/hurl/issues/3297
213+
[time units]: http://hurl.dev/blog/2024/08/29/hurl-5.0.0-the-parallel-edition.html#time-units

sites/hurl.dev/_posts/feed.xml

Lines changed: 140 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,147 @@
33
<title>Hurl Blog</title>
44
<link href="https://hurl.dev/blog/feed.xml" rel="self" type="application/atom+xml" />
55
<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>
77
<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 &gt; 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>
8147
<entry>
9148
<title>Hurl 5.0.0, the Parallel Edition</title>
10149
<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"/>
2.76 KB
Binary file not shown.
19.6 KB
Loading
3.72 KB
Loading

0 commit comments

Comments
 (0)