HURL(1)

NAME

hurlHurl, run and test HTTP requests with plain text.

SYNOPSIS

$sudo apt install .

INFO

18.7k stars
716 forks
0 views

DESCRIPTION

Hurl, run and test HTTP requests with plain text.

README

Hurl Logo

deploy status coverage Crates.io documentation

What's Hurl?

Hurl is a command line tool that runs HTTP requests defined in a simple plain text format.

It can chain requests, capture values and evaluate queries on headers and body response. Hurl is very versatile: it can be used for both fetching data and testing HTTP sessions.

Hurl makes it easy to work with HTML content, REST / SOAP / GraphQL APIs, or any other XML / JSON based APIs.

# Go home and capture token
GET https://example.org
HTTP 200
[Captures]
csrf_token: xpath "string(//meta[@name='_csrf_token']/@content)"

Do login!

POST https://example.org/login [Form] user: toto password: 1234 token: {{csrf_token}} HTTP 302

Chaining multiple requests is easy:

GET https://example.org/api/health
GET https://example.org/api/step1
GET https://example.org/api/step2
GET https://example.org/api/step3

Also an HTTP Test Tool

Hurl can run HTTP requests but can also be used to test HTTP responses. Different types of queries and predicates are supported, from XPath and JSONPath on body response, to assert on status code and response headers.

Hurl Demo

It is well adapted for REST / JSON APIs

POST https://example.org/api/tests
{
    "id": "4568",
    "evaluate": true
}
HTTP 200
[Asserts]
header "X-Frame-Options" == "SAMEORIGIN"
jsonpath "$.status" == "RUNNING"    # Check the status code
jsonpath "$.tests" count == 25      # Check the number of items
jsonpath "$.id" matches /\d{4}/     # Check the format of the id

HTML content

GET https://example.org
HTTP 200
[Asserts]
xpath "normalize-space(//head/title)" == "Hello world!"

GraphQL

POST https://example.org/graphql
```graphql
{
  human(id: "1000") {
    name
    height(unit: FOOT)
  }
}
```
HTTP 200

and even SOAP APIs

POST https://example.org/InStock
Content-Type: application/soap+xml; charset=utf-8
SOAPAction: "http://www.w3.org/2003/05/soap-envelope"
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:m="https://example.org">
  <soap:Header></soap:Header>
  <soap:Body>
    <m:GetStockPrice>
      <m:StockName>GOOG</m:StockName>
    </m:GetStockPrice>
  </soap:Body>
</soap:Envelope>
HTTP 200

Hurl can also be used to test the performance of HTTP endpoints

GET https://example.org/api/v1/pets
HTTP 200
[Asserts]
duration < 1000  # Duration in ms

And check response bytes

GET https://example.org/data.tar.gz
HTTP 200
[Asserts]
sha256 == hex,039058c6f2c0cb492c533b0a4d14ef77cc0f78abccced5287d84a1a2011cfb81;

Finally, Hurl is easy to integrate in CI/CD, with text, JUnit, TAP and HTML reports

HTML report

Why Hurl?

  • Text Format: for both devops and developers
  • Fast CLI: a command line for local dev and continuous integration
  • Single Binary: easy to install, with no runtime required

Powered by curl

Hurl is a lightweight binary written in Rust. Under the hood, Hurl HTTP engine is powered by libcurl, one of the most powerful and reliable file transfer libraries. With its text file format, Hurl adds syntactic sugar to run and test HTTP requests, but it's still the curl that we love: fast, efficient and IPv6 / HTTP/3 ready.

Feedbacks

To support its development, star Hurl on GitHub!

Feedback, suggestion, bugs or improvements are welcome.

POST https://hurl.dev/api/feedback
{
  "name": "John Doe",
  "feedback": "Hurl is awesome!"
}
HTTP 200

Resources

License

Blog

Tutorial

Documentation (download HTML, PDF, Markdown)

GitHub

Table of Contents

Samples

To run a sample, edit a file with the sample content, and run Hurl:

$ vi sample.hurl

GET https://example.org

$ hurl sample.hurl

By default, Hurl behaves like curl and outputs the last HTTP response's entry. To have a test oriented output, you can use --test option:

$ hurl --test sample.hurl

A particular response can be saved with [Options] section:

GET https://example.ord/cats/123
[Options]
output: cat123.txt    # use - to output to stdout
HTTP 200

GET https://example.ord/dogs/567 HTTP 200

Finally, Hurl can take files as input, or directories. In the latter case, Hurl will search files with .hurl extension recursively.

$ hurl --test integration/*.hurl
$ hurl --test .

You can check Hurl tests suite for more samples.

Getting Data

A simple GET:

GET https://example.org

Requests can be chained:

GET https://example.org/a
GET https://example.org/b
HEAD https://example.org/c
GET https://example.org/c

Doc

HTTP Headers

A simple GET with headers:

GET https://example.org/news
User-Agent: Mozilla/5.0 
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Connection: keep-alive

Doc

Query Params

GET https://example.org/news
[Query]
order: newest
search: something to search
count: 100

Or:

GET https://example.org/news?order=newest&search=something%20to%20search&count=100

With [Query] section, params don't need to be URL escaped.

Doc

Basic Authentication

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

Doc

This is equivalent to construct the request with a Authorization header:

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

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

$ hurl --user bob:secret login.hurl

--user option can also be set per request:

GET https://example.org/login
[Options]
user: bob:secret
HTTP 200

GET https://example.org/login [Options] user: alice:secret HTTP 200

Passing Data between Requests

Captures can be used to pass data from one request to another:

POST https://sample.org/orders
HTTP 201
[Captures]
order_id: jsonpath "$.order.id"

GET https://sample.org/orders/{{order_id}} HTTP 200

Doc

Sending Data

Sending HTML Form Data

POST https://example.org/contact
[Form]
default: false
token: {{token}}
email: john.doe@rookie.org
number: 33611223344

Doc

Sending Multipart Form Data

POST https://example.org/upload
[Multipart]
field1: value1
field2: file,example.txt;
# One can specify the file content type:
field3: file,example.zip; application/zip

Doc

Multipart forms can also be sent with a multiline string body:

POST https://example.org/upload
Content-Type: multipart/form-data; boundary="boundary"
```
--boundary
Content-Disposition: form-data; name="key1"

value1 --boundary Content-Disposition: form-data; name="upload1"; filename="data.txt" Content-Type: text/plain

Hello World! --boundary Content-Disposition: form-data; name="upload2"; filename="data.html" Content-Type: text/html

<div>Hello <b>World</b>!</div> --boundary--

</code></pre>
<p>In that case, files have to be inlined in the Hurl file.</p>
<p><a href="https://hurl.dev/docs/request.html#multiline-string-body">Doc</a></p>
<h3>Posting a JSON Body</h3>
<p>With an inline JSON:</p>
<pre><code class="language-hurl">POST https://example.org/api/tests
{
    &quot;id&quot;: &quot;456&quot;,
    &quot;evaluate&quot;: true
}
</code></pre>
<p><a href="https://hurl.dev/docs/request.html#json-body">Doc</a></p>
<p>With a local file:</p>
<pre><code class="language-hurl">POST https://example.org/api/tests
Content-Type: application/json
file,data.json;
</code></pre>
<p><a href="https://hurl.dev/docs/request.html#file-body">Doc</a></p>
<h3>Templating a JSON Body</h3>
<pre><code class="language-hurl">PUT https://example.org/api/hits
Content-Type: application/json
{
    &quot;key0&quot;: &quot;{{a_string}}&quot;,
    &quot;key1&quot;: {{a_bool}},
    &quot;key2&quot;: {{a_null}},
    &quot;key3&quot;: {{a_number}}
}
</code></pre>
<p>Variables can be initialized via command line:</p>
<pre><code class="language-shell">$ hurl --variable a_string=apple \
       --variable a_bool=true \
       --variable a_null=null \
       --variable a_number=42 \
       test.hurl
</code></pre>
<p>Resulting in a PUT request with the following JSON body:</p>
<pre><code>{
    &quot;key0&quot;: &quot;apple&quot;,
    &quot;key1&quot;: true,
    &quot;key2&quot;: null,
    &quot;key3&quot;: 42
}
</code></pre>
<p><a href="https://hurl.dev/docs/templates.html">Doc</a></p>
<h3>Templating a XML Body</h3>
<p>Using templates with <a href="https://hurl.dev/docs/request.html#xml-body">XML body</a> is not currently supported in Hurl. You can use templates in
<a href="https://hurl.dev/docs/request.html#multiline-string-body">XML multiline string body</a> with variables to send a variable XML body:</p>
<pre><code class="language-hurl">POST https://example.org/echo/post/xml
```xml
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;Request&gt;
    &lt;Login&gt;{{login}}&lt;/Login&gt;
    &lt;Password&gt;{{password}}&lt;/Password&gt;
&lt;/Request&gt;

Doc

Using GraphQL Query

A simple GraphQL query:

POST https://example.org/starwars/graphql
```graphql
{
  human(id: "1000") {
    name
    height(unit: FOOT)
  }
}
```

A GraphQL query with variables:

POST https://example.org/starwars/graphql
```graphql
query Hero($episode: Episode, $withFriends: Boolean!) {
  hero(episode: $episode) {
    name
    friends @include(if: $withFriends) {
      name
    }
  }
}

variables { "episode": "JEDI", "withFriends": false }

</code></pre>
<p>GraphQL queries can also use <a href="https://hurl.dev/docs/templates.html">Hurl templates</a>.</p>
<p><a href="https://hurl.dev/docs/request.html#graphql-body">Doc</a></p>
<h3>Using Dynamic Datas</h3>
<p><a href="https://hurl.dev/docs/templates.html#functions">Functions</a> like <code>newUuid</code> and <code>newDate</code> can be used in templates to create dynamic datas:</p>
<p>A file that creates a dynamic email (i.e <code>0531f78f-7f87-44be-a7f2-969a1c4e6d97@test.com</code>):</p>
<pre><code class="language-hurl">POST https://example.org/api/foo
{
  &quot;name&quot;: &quot;foo&quot;,
  &quot;email&quot;: &quot;{{newUuid}}@test.com&quot;
}
</code></pre>
<p>A file that creates a dynamic query parameter (i.e <code>2024-12-02T10:35:44.461731Z</code>):</p>
<pre><code class="language-hurl">GET https://example.org/api/foo
[Query]
date: {{newDate}}
HTTP 200
</code></pre>
<p><a href="https://hurl.dev/docs/templates.html#functions">Doc</a></p>
<h2>Testing Response</h2>
<p>Responses are optional, everything after <code>HTTP</code> is part of the response asserts.</p>
<pre><code class="language-hurl"># A request with (almost) no check:
GET https://foo.com

# A status code check:
GET https://foo.com
HTTP 200

# A test on response body
GET https://foo.com
HTTP 200
[Asserts]
jsonpath &quot;$.state&quot; == &quot;running&quot;
</code></pre>
<h3>Testing Status Code</h3>
<pre><code class="language-hurl">GET https://example.org/order/435
HTTP 200
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#version-status">Doc</a></p>
<pre><code class="language-hurl">GET https://example.org/order/435
# Testing status code is in a 200-300 range
HTTP *
[Asserts]
status &gt;= 200
status &lt; 300
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#status-assert">Doc</a></p>
<h3>Testing Response Headers</h3>
<p>Use implicit response asserts to test header values:</p>
<pre><code class="language-hurl">GET https://example.org/index.html
HTTP 200
Set-Cookie: theme=light
Set-Cookie: sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#headers">Doc</a></p>
<p>Or use explicit response asserts with <a href="https://hurl.dev/docs/asserting-response.html#predicates">predicates</a>:</p>
<pre><code class="language-hurl">GET https://example.org
HTTP 302
[Asserts]
header &quot;Location&quot; contains &quot;www.example.net&quot;
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#header-assert">Doc</a></p>
<p>Implicit and explicit asserts can be combined:</p>
<pre><code class="language-hurl">GET https://example.org/index.html
HTTP 200
Set-Cookie: theme=light
Set-Cookie: sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT
[Asserts]
header &quot;Location&quot; contains &quot;www.example.net&quot;
</code></pre>
<h3>Testing REST APIs</h3>
<p>Asserting JSON body response (node values, collection count etc...) with <a href="https://goessner.net/articles/JsonPath/">JSONPath</a>:</p>
<pre><code class="language-hurl">GET https://example.org/order
screencapability: low
HTTP 200
[Asserts]
jsonpath &quot;$.validated&quot; == true
jsonpath &quot;$.userInfo&quot; isObject
jsonpath &quot;$.userInfo.firstName&quot; == &quot;Franck&quot;
jsonpath &quot;$.userInfo.lastName&quot; == &quot;Herbert&quot;
jsonpath &quot;$.hasDevice&quot; == false
jsonpath &quot;$.links&quot; count == 12
jsonpath &quot;$.state&quot; != null
jsonpath &quot;$.order&quot; matches &quot;^order-\\d{8}$&quot;
jsonpath &quot;$.order&quot; matches /^order-\d{8}$/  # Alternative syntax with regex literal
jsonpath &quot;$.id&quot; matches /(?i)[a-z]*/        # See syntax for flags &lt;https://docs.rs/regex/latest/regex/#grouping-and-flags&gt;
jsonpath &quot;$.created&quot; isIsoDate
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#jsonpath-assert">Doc</a></p>
<h3>Testing HTML Response</h3>
<pre><code class="language-hurl">GET https://example.org
HTTP 200
Content-Type: text/html; charset=UTF-8
[Asserts]
xpath &quot;string(/html/head/title)&quot; contains &quot;Example&quot; # Check title
xpath &quot;count(//p)&quot; == 2  # Check the number of p
xpath &quot;//p&quot; count == 2  # Similar assert for p
xpath &quot;boolean(count(//h2))&quot; == false  # Check there is no h2  
xpath &quot;//h2&quot; not exists  # Similar assert for h2
xpath &quot;string(//div[1])&quot; matches /Hello.*/
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#xpath-assert">Doc</a></p>
<h3>Testing Set-Cookie Attributes</h3>
<pre><code class="language-hurl">GET https://example.org/home
HTTP 200
[Asserts]
cookie &quot;JSESSIONID&quot; == &quot;8400BAFE2F66443613DC38AE3D9D6239&quot;
cookie &quot;JSESSIONID[Value]&quot; == &quot;8400BAFE2F66443613DC38AE3D9D6239&quot;
cookie &quot;JSESSIONID[Expires]&quot; contains &quot;Wed, 13 Jan 2021&quot;
cookie &quot;JSESSIONID[Secure]&quot; exists
cookie &quot;JSESSIONID[HttpOnly]&quot; exists
cookie &quot;JSESSIONID[SameSite]&quot; == &quot;Lax&quot;
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#cookie-assert">Doc</a></p>
<h3>Testing Bytes Content</h3>
<p>Check the SHA-256 response body hash:</p>
<pre><code class="language-hurl">GET https://example.org/data.tar.gz
HTTP 200
[Asserts]
sha256 == hex,039058c6f2c0cb492c533b0a4d14ef77cc0f78abccced5287d84a1a2011cfb81;
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#sha-256-assert">Doc</a></p>
<h3>SSL Certificate</h3>
<p>Check the properties of a SSL certificate:</p>
<pre><code class="language-hurl">GET https://example.org
HTTP 200
[Asserts]
certificate &quot;Subject&quot; == &quot;CN=example.org&quot;
certificate &quot;Issuer&quot; == &quot;C=US, O=Let&#39;s Encrypt, CN=R3&quot;
certificate &quot;Expire-Date&quot; daysAfterNow &gt; 15
certificate &quot;Serial-Number&quot; matches /[\da-f]+/
certificate &quot;Subject-Alt-Name&quot; contains &quot;DNS:example.org&quot;
certificate &quot;Subject-Alt-Name&quot; split &quot;,&quot; count == 2
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#ssl-certificate-assert">Doc</a></p>
<h3>Checking Full Body</h3>
<p>Use implicit body to test an exact JSON body match:</p>
<pre><code class="language-hurl">GET https://example.org/api/cats/123
HTTP 200
{
  &quot;name&quot; : &quot;Purrsloud&quot;,
  &quot;species&quot; : &quot;Cat&quot;,
  &quot;favFoods&quot; : [&quot;wet food&quot;, &quot;dry food&quot;, &quot;&lt;strong&gt;any&lt;/strong&gt; food&quot;],
  &quot;birthYear&quot; : 2016,
  &quot;photo&quot; : &quot;https://learnwebcode.github.io/json-example/images/cat-2.jpg&quot;
}
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#json-body">Doc</a></p>
<p>Or an explicit assert file:</p>
<pre><code class="language-hurl">GET https://example.org/index.html
HTTP 200
[Asserts]
body == file,cat.json;
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#body-assert">Doc</a></p>
<p>Implicit asserts supports XML body:</p>
<pre><code class="language-hurl">GET https://example.org/api/catalog
HTTP 200
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;catalog&gt;
   &lt;book id=&quot;bk101&quot;&gt;
      &lt;author&gt;Gambardella, Matthew&lt;/author&gt;
      &lt;title&gt;XML Developer&#39;s Guide&lt;/title&gt;
      &lt;genre&gt;Computer&lt;/genre&gt;
      &lt;price&gt;44.95&lt;/price&gt;
      &lt;publish_date&gt;2000-10-01&lt;/publish_date&gt;
      &lt;description&gt;An in-depth look at creating applications with XML.&lt;/description&gt;
   &lt;/book&gt;
&lt;/catalog&gt;
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#xml-body">Doc</a></p>
<p>Plain text:</p>
<pre><code class="language-hurl">GET https://example.org/models
HTTP 200

Year,Make,Model,Description,Price 1997,Ford,E350,"ac, abs, moon",3000.00 1999,Chevy,"Venture ""Extended Edition""","",4900.00 1999,Chevy,"Venture ""Extended Edition, Very Large""",,5000.00 1996,Jeep,Grand Cherokee,"MUST SELL! air, moon roof, loaded",4799.00

</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#multiline-string-body">Doc</a></p>
<p>One line:</p>
<pre><code class="language-hurl">POST https://example.org/helloworld
HTTP 200
`Hello world!`
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#oneline-string-body">Doc</a></p>
<p>File:</p>
<pre><code class="language-hurl">GET https://example.org
HTTP 200
file,data.bin;
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#file-body">Doc</a></p>
<h3>Testing Redirections</h3>
<p>By default, Hurl doesn&#39;t follow redirection so each step of a redirect must be run manually and can be analysed:</p>
<pre><code class="language-hurl">GET https://example.org/step1
HTTP 301
[Asserts]
header &quot;Location&quot; == &quot;https://example.org/step2&quot;


GET https://example.org/step2
HTTP 301
[Asserts]
header &quot;Location&quot; == &quot;https://example.org/step3&quot;


GET https://example.org/step3
HTTP 200
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html">Doc</a></p>
<p>Using <a href="https://hurl.dev/docs/manual.html#location"><code>--location</code></a> and <a href="https://hurl.dev/docs/manual.html#location-trusted"><code>--location-trusted</code></a> (either with command line option or per request), Hurl follows 
redirection and each step of the redirection can be checked.</p>
<pre><code class="language-hurl">GET https://example.org/step1
[Options]
location: true
HTTP 200
[Asserts]
redirects count == 2
redirects nth 0 location == &quot;https://example.org/step2&quot;
redirects nth 1 location == &quot;https://example.org/step3&quot;
</code></pre>
<pre><code class="language-hurl">GET https://example.org/step1
[Options]
location-trusted: true
HTTP 200
[Asserts]
redirects last location == &quot;https://example.org/step2&quot;
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#redirects-assert">Doc</a></p>
<h2>Debug Tips</h2>
<h3>Verbose Mode</h3>
<p>To get more info on a given request/response, use <a href="https://hurl.dev/docs/request.html#options"><code>[Options]</code> section</a>:</p>
<pre><code class="language-hurl">GET https://example.org
HTTP 200

GET https://example.org/api/cats/123
[Options]
very-verbose: true
HTTP 200
</code></pre>
<p><code>--verbose</code> and <code>--very-verbose</code> can be also used globally as command line options.</p>
<p><a href="https://hurl.dev/docs/manual.html#very-verbose">Doc</a></p>
<h3>Error Format</h3>
<pre><code class="language-shell">$ hurl --test --error-format long *.hurl
</code></pre>
<p><a href="https://hurl.dev/docs/manual.html#error-format">Doc</a></p>
<h3>Output Response Body</h3>
<p>Use <code>--output</code> on a specific request to get the response body (<code>-</code> can be used as standard output):</p>
<pre><code class="language-hurl">GET https://foo.com/failure
[Options]
# use - to output on standard output, foo.bin to save on disk 
output: -
HTTP 200

GET https://foo.com/success
HTTP 200
</code></pre>
<p><a href="https://hurl.dev/docs/manual.html#output">Doc</a></p>
<h3>Export curl Commands</h3>
<pre><code class="language-shell">$ hurl ---curl /tmp/curl.txt *.hurl
</code></pre>
<p><a href="https://hurl.dev/docs/manual.html#curl">Doc</a></p>
<h3>Using Proxy</h3>
<p>Use <code>--proxy</code> on a specific request or globally as command line option:</p>
<pre><code class="language-hurl">GET https://foo.com/a
HTTP 200

GET https://foo.com/b
[Options]
proxy: localhost:8888
HTTP 200

GET https://foo.com/c
HTTP 200
</code></pre>
<h2>Reports</h2>
<h3>HTML Report</h3>
<pre><code class="language-shell">$ hurl --test --report-html build/report/ *.hurl
</code></pre>
<p><a href="https://hurl.dev/docs/running-tests.html#generating-report">Doc</a></p>
<h3>JSON Report</h3>
<pre><code class="language-shell">$ hurl --test --report-json build/report/ *.hurl
</code></pre>
<p><a href="https://hurl.dev/docs/running-tests.html#generating-report">Doc</a></p>
<h3>JUnit Report</h3>
<pre><code class="language-shell">$ hurl --test --report-junit build/report.xml *.hurl
</code></pre>
<p><a href="https://hurl.dev/docs/running-tests.html#generating-report">Doc</a></p>
<h3>TAP Report</h3>
<pre><code class="language-shell">$ hurl --test --report-tap build/report.txt *.hurl
</code></pre>
<p><a href="https://hurl.dev/docs/running-tests.html#generating-report">Doc</a></p>
<h3>JSON Output</h3>
<p>A structured output of running Hurl files can be obtained with <a href="https://hurl.dev/docs/manual.html#json"><code>--json</code> option</a>. Each file will produce a JSON export of the run.</p>
<pre><code class="language-shell">$ hurl --json *.hurl
</code></pre>
<h2>Others</h2>
<h3>HTTP Version</h3>
<p>Testing HTTP version (HTTP/1.0, HTTP/1.1, HTTP/2 or HTTP/3) can be done using implicit asserts:</p>
<pre><code class="language-hurl">GET https://foo.com
HTTP/3 200

GET https://bar.com
HTTP/2 200
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#version-status">Doc</a></p>
<p>Or explicit:</p>
<pre><code class="language-hurl">GET https://foo.com
HTTP 200
[Asserts]
version == &quot;3&quot;

GET https://bar.com
HTTP 200
[Asserts]
version == &quot;2&quot;
version toFloat &gt; 1.1
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#version-assert">Doc</a></p>
<h3>IP Address</h3>
<p>Testing the IP address of the response, as a string. This string may be IPv6 address:</p>
<pre><code class="language-hurl">GET https://foo.com
HTTP 200
[Asserts]
ip == &quot;2001:0db8:85a3:0000:0000:8a2e:0370:733&quot;
ip startsWith &quot;2001&quot;
ip isIpv6
</code></pre>
<h3>Polling and Retry</h3>
<p>Retry request on any errors (asserts, captures, status code, runtime etc...):</p>
<pre><code class="language-hurl"># Create a new job
POST https://api.example.org/jobs
HTTP 201
[Captures]
job_id: jsonpath &quot;$.id&quot;
[Asserts]
jsonpath &quot;$.state&quot; == &quot;RUNNING&quot;


# Pull job status until it is completed
GET https://api.example.org/jobs/{{job_id}}
[Options]
retry: 10   # maximum number of retry, -1 for unlimited
retry-interval: 500ms
HTTP 200
[Asserts]
jsonpath &quot;$.state&quot; == &quot;COMPLETED&quot;
</code></pre>
<p><a href="https://hurl.dev/docs/entry.html#retry">Doc</a></p>
<h3>Delaying Requests</h3>
<p>Add delay for every request, or a particular request:</p>
<pre><code class="language-hurl"># Delaying this request by 5 seconds (aka sleep)
GET https://example.org/turtle
[Options]
delay: 5s
HTTP 200

# No delay!
GET https://example.org/turtle
HTTP 200
</code></pre>
<p><a href="https://hurl.dev/docs/manual.html#delay">Doc</a></p>
<h3>Skipping Requests</h3>
<pre><code class="language-hurl"># a, c, d are run, b is skipped
GET https://example.org/a

GET https://example.org/b
[Options]
skip: true

GET https://example.org/c

GET https://example.org/d
</code></pre>
<p><a href="https://hurl.dev/docs/manual.html#skip">Doc</a></p>
<h3>Testing Endpoint Performance</h3>
<pre><code class="language-hurl">GET https://sample.org/helloworld
HTTP *
[Asserts]
duration &lt; 1000   # Check that response time is less than one second
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#duration-assert">Doc</a></p>
<h3>Using SOAP APIs</h3>
<pre><code class="language-hurl">POST https://example.org/InStock
Content-Type: application/soap+xml; charset=utf-8
SOAPAction: &quot;http://www.w3.org/2003/05/soap-envelope&quot;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;soap:Envelope xmlns:soap=&quot;http://www.w3.org/2003/05/soap-envelope&quot; xmlns:m=&quot;https://example.org&quot;&gt;
  &lt;soap:Header&gt;&lt;/soap:Header&gt;
  &lt;soap:Body&gt;
    &lt;m:GetStockPrice&gt;
      &lt;m:StockName&gt;GOOG&lt;/m:StockName&gt;
    &lt;/m:GetStockPrice&gt;
  &lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;
HTTP 200
</code></pre>
<p><a href="https://hurl.dev/docs/request.html#xml-body">Doc</a></p>
<h3>Capturing and Using a CSRF Token</h3>
<pre><code class="language-hurl">GET https://example.org
HTTP 200
[Captures]
csrf_token: xpath &quot;string(//meta[@name=&#39;_csrf_token&#39;]/@content)&quot;


POST https://example.org/login?user=toto&amp;password=1234
X-CSRF-TOKEN: {{csrf_token}}
HTTP 302
</code></pre>
<p><a href="https://hurl.dev/docs/capturing-response.html#xpath-capture">Doc</a></p>
<h3>Redacting Secrets</h3>
<p>Using command-line for known values:</p>
<pre><code class="language-shell">$ hurl --secret token=1234 file.hurl
</code></pre>
<pre><code class="language-hurl">POST https://example.org
X-Token: {{token}}
{
  &quot;name&quot;: &quot;Alice&quot;,
  &quot;value&quot;: 100
}
HTTP 200
</code></pre>
<p><a href="https://hurl.dev/docs/templates.html#secrets">Doc</a></p>
<p>Using <code>redact</code> for dynamic values:</p>
<pre><code class="language-hurl"># Get an authorization token:
GET https://example.org/token
HTTP 200
[Captures]
token: header &quot;X-Token&quot; redact

# Send an authorized request:
POST https://example.org
X-Token: {{token}}
{
  &quot;name&quot;: &quot;Alice&quot;,
  &quot;value&quot;: 100
}
HTTP 200
</code></pre>
<p><a href="https://hurl.dev/docs/capturing-response.html#redacting-secrets">Doc</a></p>
<h3>Checking Byte Order Mark (BOM) in Response Body</h3>
<pre><code class="language-hurl">GET https://example.org/data.bin
HTTP 200
[Asserts]
bytes startsWith hex,efbbbf;
</code></pre>
<p><a href="https://hurl.dev/docs/asserting-response.html#bytes-assert">Doc</a></p>
<h3>AWS Signature Version 4 Requests</h3>
<p>Generate signed API requests with <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html">AWS Signature Version 4</a>, as used by several cloud providers.</p>
<pre><code class="language-hurl">POST https://sts.eu-central-1.amazonaws.com/
[Options]
aws-sigv4: aws:amz:eu-central-1:sts
[Form]
Action: GetCallerIdentity
Version: 2011-06-15
</code></pre>
<p>The Access Key is given per <a href="https://hurl.dev/docs/manual.html#user"><code>--user</code></a>, either with command line option or within the <a href="https://hurl.dev/docs/request.html#options"><code>[Options]</code></a> section:</p>
<pre><code class="language-hurl">POST https://sts.eu-central-1.amazonaws.com/
[Options]
aws-sigv4: aws:amz:eu-central-1:sts
user: bob=secret
[Form]
Action: GetCallerIdentity
Version: 2011-06-15
</code></pre>
<p><a href="https://hurl.dev/docs/manual.html#aws-sigv4">Doc</a></p>
<h3>Using curl Options</h3>
<p>curl options (for instance <a href="https://hurl.dev/docs/manual.html#resolve"><code>--resolve</code></a> or <a href="https://hurl.dev/docs/manual.html#connect-to"><code>--connect-to</code></a>) can be used as CLI argument. In this case, they&#39;re applicable
to each request of an Hurl file.</p>
<pre><code class="language-shell">$ hurl --resolve foo.com:8000:127.0.0.1 foo.hurl
</code></pre>
<p>Use  <a href="https://hurl.dev/docs/request.html#options"><code>[Options]</code> section</a> to configure a specific request:</p>
<pre><code class="language-hurl">GET http://bar.com
HTTP 200


GET http://foo.com:8000/resolve
[Options]
resolve: foo.com:8000:127.0.0.1
HTTP 200
`Hello World!`
</code></pre>
<p><a href="https://hurl.dev/docs/request.html#options">Doc</a></p>
<h1>Manual</h1>
<h2>Name</h2>
<p>hurl - run and test HTTP requests.</p>
<h2>Synopsis</h2>
<p><strong>hurl</strong> [OPTIONS] [FILES...]</p>
<p><strong>hurl</strong> --test [OPTIONS] [FILES...]</p>
<h2>Description</h2>
<p><strong>Hurl</strong> is a command line tool that runs HTTP requests defined in a simple plain text format.</p>
<p>It can chain requests, capture values and evaluate queries on headers and body response. Hurl is very versatile, it can be used for fetching data and testing HTTP sessions: HTML content, REST / SOAP / GraphQL APIs, or any other XML / JSON based APIs.</p>
<pre><code class="language-shell">$ hurl session.hurl
</code></pre>
<p>If no input files are specified, input is read from stdin.</p>
<pre><code class="language-shell">$ echo GET http://httpbin.org/get | hurl
    {
      &quot;args&quot;: {},
      &quot;headers&quot;: {
        &quot;Accept&quot;: &quot;*/*&quot;,
        &quot;Accept-Encoding&quot;: &quot;gzip&quot;,
        &quot;Content-Length&quot;: &quot;0&quot;,
        &quot;Host&quot;: &quot;httpbin.org&quot;,
        &quot;User-Agent&quot;: &quot;hurl/0.99.10&quot;,
        &quot;X-Amzn-Trace-Id&quot;: &quot;Root=1-5eedf4c7-520814d64e2f9249ea44e0&quot;
      },
      &quot;origin&quot;: &quot;1.2.3.4&quot;,
      &quot;url&quot;: &quot;http://httpbin.org/get&quot;
    }
</code></pre>
<p>Hurl can take files as input, or directories. In the latter case, Hurl will search files with <code>.hurl</code> extension recursively.</p>
<p>Output goes to stdout by default. To have output go to a file, use the <a href="#output"><code>-o, --output</code></a> option:</p>
<pre><code class="language-shell">$ hurl -o output input.hurl
</code></pre>
<p>By default, Hurl executes all HTTP requests and outputs the response body of the last HTTP call.</p>
<p>To have a test oriented output, you can use <a href="#test"><code>--test</code></a> option:</p>
<pre><code class="language-shell">$ hurl --test *.hurl
</code></pre>
<h2>Hurl File Format</h2>
<p>The Hurl file format is fully documented in <a href="https://hurl.dev/docs/hurl-file.html">https://hurl.dev/docs/hurl-file.html</a></p>
<p>It consists of one or several HTTP requests</p>
<pre><code class="language-hurl">GET http://example.org/endpoint1
GET http://example.org/endpoint2
</code></pre>
<h3>Capturing values</h3>
<p>A value from an HTTP response can be-reused for successive HTTP requests.</p>
<p>A typical example occurs with CSRF tokens.</p>
<pre><code class="language-hurl">GET https://example.org
HTTP 200
# Capture the CSRF token value from html body.
[Captures]
csrf_token: xpath &quot;normalize-space(//meta[@name=&#39;_csrf_token&#39;]/@content)&quot;

# Do the login !
POST https://example.org/login?user=toto&amp;password=1234
X-CSRF-TOKEN: {{csrf_token}}
</code></pre>
<p>More information on captures can be found here <a href="https://hurl.dev/docs/capturing-response.html">https://hurl.dev/docs/capturing-response.html</a></p>
<h3>Asserts</h3>
<p>The HTTP response defined in the Hurl file are used to make asserts. Responses are optional.</p>
<p>At the minimum, response includes assert on the HTTP status code.</p>
<pre><code class="language-hurl">GET http://example.org
HTTP 301
</code></pre>
<p>It can also include asserts on the response headers</p>
<pre><code class="language-hurl">GET http://example.org
HTTP 301
Location: http://www.example.org
</code></pre>
<p>Explicit asserts can be included by combining a query and a predicate</p>
<pre><code class="language-hurl">GET http://example.org
HTTP 301
[Asserts]
xpath &quot;string(//title)&quot; == &quot;301 Moved&quot;
</code></pre>
<p>With the addition of asserts, Hurl can be used as a testing tool to run scenarios.</p>
<p>More information on asserts can be found here <a href="https://hurl.dev/docs/asserting-response.html">https://hurl.dev/docs/asserting-response.html</a></p>
<h2>Options</h2>
<p>Options that exist in curl have exactly the same semantics.</p>
<p>Options specified on the command line are defined for every Hurl file&#39;s entry,
except if they are tagged as cli-only (can not be defined in the Hurl request [Options] entry)</p>
<p>For instance:</p>
<pre><code class="language-shell">$ hurl --location foo.hurl
</code></pre>
<p>will follow redirection for each entry in <code>foo.hurl</code>. You can also define an option only for a particular entry with an <code>[Options]</code> section. For instance, this Hurl file:</p>
<pre><code class="language-hurl">GET https://example.org
HTTP 301

GET https://example.org
[Options]
location: true
HTTP 200
</code></pre>
<p>will follow a redirection only for the second entry.</p>
<table>
<thead>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr>
<td><a href="#aws-sigv4" id="aws-sigv4"><code>--aws-sigv4 &lt;PROVIDER1[:PROVIDER2[:REGION[:SERVICE]]]&gt;</code></a></td>
<td>Generate an <code>Authorization</code> header with an AWS SigV4 signature.<br><br>Use <a href="#user"><code>-u, --user</code></a> to specify Access Key Id (username) and Secret Key (password).<br><br>To use temporary session credentials (e.g. for an AWS IAM Role), add the <code>X-Amz-Security-Token</code> header containing the session token.<br></td>
</tr>
<tr>
<td><a href="#cacert" id="cacert"><code>--cacert &lt;FILE&gt;</code></a></td>
<td>Specifies the certificate file for peer verification. The file may contain multiple CA certificates and must be in PEM format.<br>Normally Hurl is built to use a default file for this, so this option is typically used to alter that default file.<br></td>
</tr>
<tr>
<td><a href="#cert" id="cert"><code>-E, --cert &lt;CERTIFICATE[:PASSWORD]&gt;</code></a></td>
<td>Client certificate file and password.<br><br>See also <a href="#key"><code>--key</code></a>.<br></td>
</tr>
<tr>
<td><a href="#color" id="color"><code>--color</code></a></td>
<td>Colorize standard output and standard error.<br><br>By default, Hurl outputs a prettified and colorized response. When redirected through pipes, standard streams are not colorized and color can be forced with this option.<br><br>Environment variables: HURL_COLOR<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#compressed" id="compressed"><code>--compressed</code></a></td>
<td>Request a compressed response using one of the algorithms br, gzip, deflate and automatically decompress the content.<br></td>
</tr>
<tr>
<td><a href="#connect-timeout" id="connect-timeout"><code>--connect-timeout &lt;SECONDS&gt;</code></a></td>
<td>Maximum time in seconds that you allow Hurl&#39;s connection to take.<br><br>You can specify time units in the connect timeout expression. Set Hurl to use a connect timeout of 20 seconds with <code>--connect-timeout 20s</code> or set it to 35,000 milliseconds with <code>--connect-timeout 35000ms</code>. No spaces allowed.<br><br>See also <a href="#max-time"><code>-m, --max-time</code></a>.<br></td>
</tr>
<tr>
<td><a href="#connect-to" id="connect-to"><code>--connect-to &lt;HOST1:PORT1:HOST2:PORT2&gt;</code></a></td>
<td>For a request to the given HOST1:PORT1 pair, connect to HOST2:PORT2 instead. This option can be used several times in a command line.<br><br>See also <a href="#resolve"><code>--resolve</code></a>.<br></td>
</tr>
<tr>
<td><a href="#continue-on-error" id="continue-on-error"><code>--continue-on-error</code></a></td>
<td>Continue executing requests to the end of the Hurl file even when an assert error occurs.<br>By default, Hurl exits after an assert error in the HTTP response.<br><br>Note that this option does not affect the behavior with multiple input Hurl files.<br><br>All the input files are executed independently. The result of one file does not affect the execution of the other Hurl files.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#cookie" id="cookie"><code>-b, --cookie &lt;FILE&gt;</code></a></td>
<td>Read cookies from FILE (using the Netscape cookie file format).<br><br>Combined with <a href="#cookie-jar"><code>-c, --cookie-jar</code></a>, you can simulate a cookie storage between successive Hurl runs.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#cookie-jar" id="cookie-jar"><code>-c, --cookie-jar &lt;FILE&gt;</code></a></td>
<td>Write cookies to FILE after running the session.<br>The file will be written using the Netscape cookie file format.<br><br>Combined with <a href="#cookie"><code>-b, --cookie</code></a>, you can simulate a cookie storage between successive Hurl runs.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#curl" id="curl"><code>--curl &lt;FILE&gt;</code></a></td>
<td>Export each request to a list of curl commands.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#delay" id="delay"><code>--delay &lt;MILLISECONDS&gt;</code></a></td>
<td>Sets delay before each request (aka sleep). The delay is not applied to requests that have been retried because of <a href="#retry"><code>--retry</code></a>. See <a href="#retry-interval"><code>--retry-interval</code></a> to space retried requests.<br><br>You can specify time units in the delay expression. Set Hurl to use a delay of 2 seconds with <code>--delay 2s</code> or set it to 500 milliseconds with <code>--delay 500ms</code>. Supported time units: ms, s, m, h. No spaces allowed.<br></td>
</tr>
<tr>
<td><a href="#digest" id="digest"><code>--digest</code></a></td>
<td>Tell Hurl to use HTTP Digest authentication<br></td>
</tr>
<tr>
<td><a href="#error-format" id="error-format"><code>--error-format &lt;FORMAT&gt;</code></a></td>
<td>Control the format of error message (short by default or long)<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#file-root" id="file-root"><code>--file-root &lt;DIR&gt;</code></a></td>
<td>Set root directory to import files in Hurl. This is used for files in multipart form data, request body and response output.<br>When it is not explicitly defined, files are relative to the Hurl file&#39;s directory.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#from-entry" id="from-entry"><code>--from-entry &lt;ENTRY_NUMBER&gt;</code></a></td>
<td>Execute Hurl file from ENTRY_NUMBER (starting at 1).<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#glob" id="glob"><code>--glob &lt;GLOB&gt;</code></a></td>
<td>Specify input files that match the given glob pattern.<br><br>Multiple glob flags may be used. This flag supports common Unix glob patterns like *, ? and [].<br>However, to avoid your shell accidentally expanding glob patterns before Hurl handles them, you must use single quotes or double quotes around each pattern.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#header" id="header"><code>-H, --header &lt;HEADER&gt;</code></a></td>
<td>Add an extra header to include in information sent. Can be used several times in a command<br><br>Do not add newlines or carriage returns<br></td>
</tr>
<tr>
<td><a href="#http10" id="http10"><code>-0, --http1.0</code></a></td>
<td>Tells Hurl to use HTTP version 1.0 instead of using its internally preferred HTTP version.<br></td>
</tr>
<tr>
<td><a href="#http11" id="http11"><code>--http1.1</code></a></td>
<td>Tells Hurl to use HTTP version 1.1.<br></td>
</tr>
<tr>
<td><a href="#http2" id="http2"><code>--http2</code></a></td>
<td>Tells Hurl to use HTTP version 2.<br>For HTTPS, this means Hurl negotiates HTTP/2 in the TLS handshake. Hurl does this by default.<br>For HTTP, this means Hurl attempts to upgrade the request to HTTP/2 using the Upgrade: request header.<br></td>
</tr>
<tr>
<td><a href="#http3" id="http3"><code>--http3</code></a></td>
<td>Tells Hurl to try HTTP/3 to the host in the URL, but fallback to earlier HTTP versions if the HTTP/3 connection establishment fails. HTTP/3 is only available for HTTPS and not for HTTP URLs.<br></td>
</tr>
<tr>
<td><a href="#ignore-asserts" id="ignore-asserts"><code>--ignore-asserts</code></a></td>
<td>Ignore all asserts defined in the Hurl file.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#include" id="include"><code>-i, --include</code></a></td>
<td>Include the HTTP headers in the output<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#insecure" id="insecure"><code>-k, --insecure</code></a></td>
<td>This option explicitly allows Hurl to perform &quot;insecure&quot; SSL connections and transfers.<br></td>
</tr>
<tr>
<td><a href="#ipv4" id="ipv4"><code>-4, --ipv4</code></a></td>
<td>This option tells Hurl to use IPv4 addresses only when resolving host names, and not for example try IPv6.<br><br>Environment variables: HURL_IPV4<br></td>
</tr>
<tr>
<td><a href="#ipv6" id="ipv6"><code>-6, --ipv6</code></a></td>
<td>This option tells Hurl to use IPv6 addresses only when resolving host names, and not for example try IPv4.<br><br>Environment variables: HURL_IPV6<br></td>
</tr>
<tr>
<td><a href="#jobs" id="jobs"><code>--jobs &lt;NUM&gt;</code></a></td>
<td>Maximum number of parallel jobs in parallel mode. Default value corresponds (in most cases) to the<br>current amount of CPUs.<br><br>See also <a href="#parallel"><code>--parallel</code></a>.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#json" id="json"><code>--json</code></a></td>
<td>Output each Hurl file result to JSON. The format is very closed to HAR format.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#key" id="key"><code>--key &lt;KEY&gt;</code></a></td>
<td>Private key file name.<br></td>
</tr>
<tr>
<td><a href="#limit-rate" id="limit-rate"><code>--limit-rate &lt;SPEED&gt;</code></a></td>
<td>Specify the maximum transfer rate you want Hurl to use, for both downloads and uploads. This feature is useful if you have a limited pipe and you would like your transfer not to use your entire bandwidth. To make it slower than it otherwise would be.<br>The given speed is measured in bytes/second.<br></td>
</tr>
<tr>
<td><a href="#location" id="location"><code>-L, --location</code></a></td>
<td>Follow redirect. To limit the amount of redirects to follow use the <a href="#max-redirs"><code>--max-redirs</code></a> option<br></td>
</tr>
<tr>
<td><a href="#location-trusted" id="location-trusted"><code>--location-trusted</code></a></td>
<td>Like <a href="#location"><code>-L, --location</code></a>, but allows sending the name + password to all hosts that the site may redirect to.<br>This may or may not introduce a security breach if the site redirects you to a site to which you send your authentication info (which is plaintext in the case of HTTP Basic authentication).<br></td>
</tr>
<tr>
<td><a href="#max-filesize" id="max-filesize"><code>--max-filesize &lt;BYTES&gt;</code></a></td>
<td>Specify the maximum size in bytes of a file to download. If the file requested is larger than this value, the transfer does not start.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#max-redirs" id="max-redirs"><code>--max-redirs &lt;NUM&gt;</code></a></td>
<td>Set maximum number of redirection-followings allowed<br><br>By default, the limit is set to 50 redirections. Set this option to -1 to make it unlimited.<br></td>
</tr>
<tr>
<td><a href="#max-time" id="max-time"><code>-m, --max-time &lt;SECONDS&gt;</code></a></td>
<td>Maximum time in seconds that you allow a request/response to take. This is the standard timeout.<br><br>You can specify time units in the maximum time expression. Set Hurl to use a maximum time of 20 seconds with <code>--max-time 20s</code> or set it to 35,000 milliseconds with <code>--max-time 35000ms</code>. No spaces allowed.<br><br>See also <a href="#connect-timeout"><code>--connect-timeout</code></a>.<br><br>Environment variables: HURL_MAX_TIME<br></td>
</tr>
<tr>
<td><a href="#negotiate" id="negotiate"><code>--negotiate</code></a></td>
<td>Tell Hurl to use Negotiate (SPNEGO) authentication.<br></td>
</tr>
<tr>
<td><a href="#netrc" id="netrc"><code>-n, --netrc</code></a></td>
<td>Scan the .netrc file in the user&#39;s home directory for the username and password.<br><br>See also <a href="#netrc-file"><code>--netrc-file</code></a> and <a href="#netrc-optional"><code>--netrc-optional</code></a>.<br></td>
</tr>
<tr>
<td><a href="#netrc-file" id="netrc-file"><code>--netrc-file &lt;FILE&gt;</code></a></td>
<td>Like <a href="#netrc"><code>--netrc</code></a>, but provide the path to the netrc file.<br><br>See also <a href="#netrc-optional"><code>--netrc-optional</code></a>.<br></td>
</tr>
<tr>
<td><a href="#netrc-optional" id="netrc-optional"><code>--netrc-optional</code></a></td>
<td>Similar to <a href="#netrc"><code>--netrc</code></a>, but make the .netrc usage optional.<br><br>See also <a href="#netrc-file"><code>--netrc-file</code></a>.<br></td>
</tr>
<tr>
<td><a href="#no-color" id="no-color"><code>--no-color</code></a></td>
<td>Do not colorize standard output nor standard error.<br><br>Environment variables: HURL_NO_COLOR, NO_COLOR<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#no-cookie-store" id="no-cookie-store"><code>--no-cookie-store</code></a></td>
<td>Do not use cookie storage for requests/responses in a file. By default, requests in the same Hurl file share cookie storage, this option deactivates cookie engine.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#no-output" id="no-output"><code>--no-output</code></a></td>
<td>Suppress output. By default, Hurl outputs the body of the last response.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#no-pretty" id="no-pretty"><code>--no-pretty</code></a></td>
<td>Do not prettify response output for supported content type (JSON only for the moment). By default, output is prettified if<br>standard output is a terminal.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#no-proxy" id="no-proxy"><code>--no-proxy &lt;HOST(S)&gt;</code></a></td>
<td>Comma-separated list of hosts which do not use a proxy.<br><br>Override value from Environment variable no_proxy.<br></td>
</tr>
<tr>
<td><a href="#ntlm" id="ntlm"><code>--ntlm</code></a></td>
<td>Tell Hurl to use NTLM authentication<br></td>
</tr>
<tr>
<td><a href="#output" id="output"><code>-o, --output &lt;FILE&gt;</code></a></td>
<td>Write output to FILE instead of stdout. Use &#39;-&#39; for stdout in [Options] sections.<br></td>
</tr>
<tr>
<td><a href="#parallel" id="parallel"><code>--parallel</code></a></td>
<td>Run files in parallel.<br><br>Each Hurl file is executed in its own worker thread, without sharing anything with the other workers. The default run mode is sequential. Parallel execution is by default in <a href="#test"><code>--test</code></a> mode.<br><br>See also <a href="#jobs"><code>--jobs</code></a>.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#path-as-is" id="path-as-is"><code>--path-as-is</code></a></td>
<td>Tell Hurl to not handle sequences of /../ or /./ in the given URL path. Normally Hurl will squash or merge them according to standards but with this option set you tell it not to do that.<br></td>
</tr>
<tr>
<td><a href="#pinnedpubkey" id="pinnedpubkey"><code>--pinnedpubkey &lt;HASHES&gt;</code></a></td>
<td>When negotiating a TLS or SSL connection, the server sends a certificate indicating its identity. A public key is extracted from this certificate and if it does not exactly match the public key provided to this option, Hurl aborts the connection before sending or receiving any data.<br></td>
</tr>
<tr>
<td><a href="#pretty" id="pretty"><code>--pretty</code></a></td>
<td>Prettify response output for supported content type (JSON only for the moment). By default, JSON response is prettified if standard output is a terminal, and colorized, see<a href="#no-color"><code>--no-color</code></a> to format without color.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#progress-bar" id="progress-bar"><code>--progress-bar</code></a></td>
<td>Display a progress bar in test mode. The progress bar is displayed only in interactive TTYs. This option forces the progress bar to be displayed even in non-interactive TTYs.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#proxy" id="proxy"><code>-x, --proxy &lt;[PROTOCOL://]HOST[:PORT]&gt;</code></a></td>
<td>Use the specified proxy.<br><br>Environment variables: http_proxy, https_proxy, all_proxy<br></td>
</tr>
<tr>
<td><a href="#repeat" id="repeat"><code>--repeat &lt;NUM&gt;</code></a></td>
<td>Repeat the input files sequence NUM times, -1 for infinite loop. Given a.hurl, b.hurl, c.hurl as input, repeat two<br>times will run a.hurl, b.hurl, c.hurl, a.hurl, b.hurl, c.hurl.<br></td>
</tr>
<tr>
<td><a href="#report-html" id="report-html"><code>--report-html &lt;DIR&gt;</code></a></td>
<td>Generate HTML report in DIR.<br><br>If the HTML report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#report-json" id="report-json"><code>--report-json &lt;DIR&gt;</code></a></td>
<td>Generate JSON report in DIR.<br><br>If the JSON report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#report-junit" id="report-junit"><code>--report-junit &lt;FILE&gt;</code></a></td>
<td>Generate JUnit File.<br><br>If the FILE report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#report-tap" id="report-tap"><code>--report-tap &lt;FILE&gt;</code></a></td>
<td>Generate TAP report.<br><br>If the FILE report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#resolve" id="resolve"><code>--resolve &lt;HOST:PORT:ADDR&gt;</code></a></td>
<td>Provide a custom address for a specific host and port pair. Using this, you can make the Hurl requests(s) use a specified address and prevent the otherwise normally resolved address to be used. Consider it a sort of /etc/hosts alternative provided on the command line.<br></td>
</tr>
<tr>
<td><a href="#retry" id="retry"><code>--retry &lt;NUM&gt;</code></a></td>
<td>Maximum number of retries, 0 for no retries, -1 for unlimited retries. Retry happens if any error occurs (asserts, captures, runtimes etc...).<br></td>
</tr>
<tr>
<td><a href="#retry-interval" id="retry-interval"><code>--retry-interval &lt;MILLISECONDS&gt;</code></a></td>
<td>Duration in milliseconds between each retry. Default is 1000 ms.<br><br>You can specify time units in the retry interval expression. Set Hurl to use a retry interval of 2 seconds with <code>--retry-interval 2s</code> or set it to 500 milliseconds with <code>--retry-interval 500ms</code>. No spaces allowed.<br></td>
</tr>
<tr>
<td><a href="#secret" id="secret"><code>--secret &lt;NAME=VALUE&gt;</code></a></td>
<td>Define secret value to be redacted from logs and report. When defined, secrets can be used as variable everywhere variables are used.<br><br>Environment variables: HURL_SECRET_name<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#secrets-file" id="secrets-file"><code>--secrets-file &lt;FILE&gt;</code></a></td>
<td>Define a secrets file in which you define your secrets<br><br>Each secret is defined as name=value exactly as with <a href="#secret"><code>--secret</code></a> option.<br><br>Note that defining a secret twice produces an error.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#ssl-no-revoke" id="ssl-no-revoke"><code>--ssl-no-revoke</code></a></td>
<td>(Windows) This option tells Hurl to disable certificate revocation checks. WARNING: this option loosens the SSL security, and by using this flag you ask for exactly that.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#test" id="test"><code>--test</code></a></td>
<td>Activate test mode: with this, the HTTP response is not outputted anymore, progress is reported for each Hurl file tested, and a text summary is displayed when all files have been run.<br><br>In test mode, files are executed in parallel. To run test in a sequential way use <code>--job 1</code>.<br><br>See also <a href="#jobs"><code>--jobs</code></a>.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#to-entry" id="to-entry"><code>--to-entry &lt;ENTRY_NUMBER&gt;</code></a></td>
<td>Execute Hurl file to ENTRY_NUMBER (starting at 1).<br>Ignore the remaining of the file. It is useful for debugging a session.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#unix-socket" id="unix-socket"><code>--unix-socket &lt;PATH&gt;</code></a></td>
<td>(HTTP) Connect through this Unix domain socket, instead of using the network.<br></td>
</tr>
<tr>
<td><a href="#user" id="user"><code>-u, --user &lt;USER:PASSWORD&gt;</code></a></td>
<td>Add basic Authentication header to each request.<br></td>
</tr>
<tr>
<td><a href="#user-agent" id="user-agent"><code>-A, --user-agent &lt;NAME&gt;</code></a></td>
<td>Specify the User-Agent string to send to the HTTP server.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#variable" id="variable"><code>--variable &lt;NAME=VALUE&gt;</code></a></td>
<td>Define variable (name/value) to be used in Hurl templates.<br><br>Environment variables: HURL_VARIABLE_name<br></td>
</tr>
<tr>
<td><a href="#variables-file" id="variables-file"><code>--variables-file &lt;FILE&gt;</code></a></td>
<td>Set properties file in which your define your variables.<br><br>Each variable is defined as name=value exactly as with <a href="#variable"><code>--variable</code></a> option.<br><br>Note that defining a variable twice produces an error.<br><br>This is a cli-only option.<br></td>
</tr>
<tr>
<td><a href="#verbose" id="verbose"><code>-v, --verbose</code></a></td>
<td>Turn on verbose output on standard error stream.<br>Useful for debugging.<br><br>A line starting with &#39;&gt;&#39; means data sent by Hurl.<br>A line staring with &#39;&lt;&#39; means data received by Hurl.<br>A line starting with &#39;*&#39; means additional info provided by Hurl.<br><br>If you only want HTTP headers in the output, <a href="#include"><code>-i, --include</code></a> might be the option you&#39;re looking for.<br><br>Environment variables: HURL_VERBOSE<br></td>
</tr>
<tr>
<td><a href="#verbosity" id="verbosity"><code>--verbosity &lt;LEVEL&gt;</code></a></td>
<td>Set the verbosity level for debug logs on standard error stream.<br>Useful for debugging.<br><br>A line starting with &#39;&gt;&#39; means data sent by Hurl.<br>A line staring with &#39;&lt;&#39; means data received by Hurl.<br>A line starting with &#39;*&#39; means additional info provided by Hurl.<br><br>If you only want HTTP headers in the output, <a href="#include"><code>-i, --include</code></a> might be the option you&#39;re looking for.<br><a href="#verbose"><code>-v, --verbose</code></a> is an alias for <code>--verbosity verbose</code><br><a href="#very-verbose"><code>--very-verbose</code></a> is an alias for <code>--verbosity debug</code><br><br>Environment variables: HURL_VERBOSITY<br></td>
</tr>
<tr>
<td><a href="#very-verbose" id="very-verbose"><code>--very-verbose</code></a></td>
<td>Turn on more verbose output on standard error stream.<br><br>In contrast to  <a href="#verbose"><code>--verbose</code></a> option, this option outputs the full HTTP body request and response on standard error. In addition, lines starting with &#39;**&#39; are libcurl debug logs.<br><br>Environment variables: HURL_VERY_VERBOSE<br></td>
</tr>
<tr>
<td><a href="#help" id="help"><code>-h, --help</code></a></td>
<td>Usage help. This lists all current command line options with a short description.<br></td>
</tr>
<tr>
<td><a href="#version" id="version"><code>-V, --version</code></a></td>
<td>Prints version information<br></td>
</tr>
</tbody></table>
<h2>Exit Codes</h2>
<table>
<thead>
<tr>
<th>Value</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr>
<td><code>0</code></td>
<td>Success.<br></td>
</tr>
<tr>
<td><code>1</code></td>
<td>Failed to parse command-line options.<br></td>
</tr>
<tr>
<td><code>2</code></td>
<td>Input File Parsing Error.<br></td>
</tr>
<tr>
<td><code>3</code></td>
<td>Runtime error (such as failure to connect to host).<br></td>
</tr>
<tr>
<td><code>4</code></td>
<td>Assert Error.<br></td>
</tr>
</tbody></table>
<h2>WWW</h2>
<p><a href="https://hurl.dev">https://hurl.dev</a></p>
<h2>See Also</h2>
<p>curl(1)  hurlfmt(1)</p>
<h1>Installation</h1>
<h2>Binaries Installation</h2>
<h3>Linux</h3>
<p>Precompiled binary (depending on libc &gt;=2.35) is available at <a href="https://github.com/Orange-OpenSource/hurl/releases/latest">Hurl latest GitHub release</a>:</p>
<pre><code class="language-shell">$ INSTALL_DIR=/tmp
$ VERSION=7.1.0
$ curl --silent --location https://github.com/Orange-OpenSource/hurl/releases/download/$VERSION/hurl-$VERSION-x86_64-unknown-linux-gnu.tar.gz | tar xvz -C $INSTALL_DIR
$ export PATH=$INSTALL_DIR/hurl-$VERSION-x86_64-unknown-linux-gnu/bin:$PATH
</code></pre>
<h4>Debian / Ubuntu</h4>
<p>For Debian &gt;=12 / Ubuntu 22.04 and 24.04, Hurl can be installed using a binary .deb file provided in each Hurl release.</p>
<pre><code class="language-shell">$ VERSION=7.1.0
$ curl --location --remote-name https://github.com/Orange-OpenSource/hurl/releases/download/$VERSION/hurl_${VERSION}_amd64.deb
$ sudo apt update &amp;&amp; sudo apt install ./hurl_${VERSION}_amd64.deb
</code></pre>
<p>For Ubuntu &gt;=22.04, Hurl can be installed from <code>ppa:lepapareil/hurl</code></p>
<pre><code class="language-shell">$ VERSION=7.1.0
$ sudo apt-add-repository -y ppa:lepapareil/hurl
$ sudo apt install hurl=&quot;${VERSION}&quot;*
</code></pre>
<h4>Alpine</h4>
<p>Hurl is available on <code>testing</code> channel.</p>
<pre><code class="language-shell">$ apk add --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing hurl
</code></pre>
<h4>Arch Linux / Manjaro</h4>
<p>Hurl is available on <a href="https://archlinux.org/packages/extra/x86_64/hurl/">extra</a> channel.</p>
<pre><code class="language-shell">$ pacman -Sy hurl
</code></pre>
<h4>NixOS / Nix</h4>
<p><a href="https://search.nixos.org/packages?from=0&size=1&sort=relevance&type=packages&query=hurl">NixOS / Nix package</a> is available on stable channel.</p>
<h3>macOS</h3>
<p>Precompiled binaries for Intel and ARM CPUs are available at <a href="https://github.com/Orange-OpenSource/hurl/releases/latest">Hurl latest GitHub release</a>.</p>
<h4>Homebrew</h4>
<pre><code class="language-shell">$ brew install hurl
</code></pre>
<h4>MacPorts</h4>
<pre><code class="language-shell">$ sudo port install hurl
</code></pre>
<h3>FreeBSD</h3>
<pre><code class="language-shell">$ sudo pkg install hurl
</code></pre>
<h3>Windows</h3>
<p>Windows requires the <a href="https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#latest-microsoft-visual-c-redistributable-version">Visual C++ Redistributable Package</a> to be installed manually, as this is not included in the installer.</p>
<h4>Zip File</h4>
<p>Hurl can be installed from a standalone zip file at <a href="https://github.com/Orange-OpenSource/hurl/releases/latest">Hurl latest GitHub release</a>. You will need to update your <code>PATH</code> variable.</p>
<h4>Installer</h4>
<p>An executable installer is also available at <a href="https://github.com/Orange-OpenSource/hurl/releases/latest">Hurl latest GitHub release</a>.</p>
<h4>Chocolatey</h4>
<pre><code class="language-shell">$ choco install hurl
</code></pre>
<h4>Scoop</h4>
<pre><code class="language-shell">$ scoop install hurl
</code></pre>
<h4>Windows Package Manager</h4>
<pre><code class="language-shell">$ winget install hurl
</code></pre>
<h3>Cargo</h3>
<p>If you&#39;re a Rust programmer, Hurl can be installed with cargo.</p>
<pre><code class="language-shell">$ cargo install --locked hurl
</code></pre>
<h3>conda-forge</h3>
<pre><code class="language-shell">$ conda install -c conda-forge hurl
</code></pre>
<p>Hurl can also be installed with <a href="https://conda-forge.org"><code>conda-forge</code></a> powered package manager like <a href="https://prefix.dev"><code>pixi</code></a>.</p>
<h3>Docker</h3>
<pre><code class="language-shell">$ docker pull ghcr.io/orange-opensource/hurl:latest
</code></pre>
<h3>npm</h3>
<pre><code class="language-shell">$ npm install --save-dev @orangeopensource/hurl
</code></pre>
<h2>Building From Sources</h2>
<p>Hurl sources are available in <a href="https://github.com/Orange-OpenSource/hurl">GitHub</a>.</p>
<h3>Build on Linux</h3>
<p>Hurl depends on libssl, libcurl and libxml2 native libraries. You will need their development files in your platform.</p>
<h4>Debian based distributions</h4>
<pre><code class="language-shell">$ apt install -y build-essential pkg-config libssl-dev libcurl4-openssl-dev libxml2-dev libclang-dev
</code></pre>
<h4>Fedora based distributions</h4>
<pre><code class="language-shell">$ dnf install -y pkgconf-pkg-config gcc openssl-devel libxml2-devel clang-devel
</code></pre>
<h4>Red Hat based distributions</h4>
<pre><code class="language-shell">$ yum install -y pkg-config gcc openssl-devel libxml2-devel clang-devel
</code></pre>
<h4>Arch based distributions</h4>
<pre><code class="language-shell">$ pacman -S --noconfirm pkgconf gcc glibc openssl libxml2 clang
</code></pre>
<h4>Alpine based distributions</h4>
<pre><code class="language-shell">$ apk add curl-dev gcc libxml2-dev musl-dev openssl-dev clang-dev
</code></pre>
<h3>Build on macOS</h3>
<pre><code class="language-shell">$ xcode-select --install
$ brew install pkg-config
</code></pre>
<p>Hurl is written in <a href="https://www.rust-lang.org">Rust</a>. You should <a href="https://www.rust-lang.org/tools/install">install</a> the latest stable release.</p>
<pre><code class="language-shell">$ curl https://sh.rustup.rs -sSf | sh -s -- -y
$ source $HOME/.cargo/env
$ rustc --version
$ cargo --version
</code></pre>
<p>Then build hurl:</p>
<pre><code class="language-shell">$ git clone https://github.com/Orange-OpenSource/hurl
$ cd hurl
$ cargo build --release
$ ./target/release/hurl --version
</code></pre>
<h3>Build on Windows</h3>
<p>Please follow the <a href="https://github.com/Orange-OpenSource/hurl/blob/master/contrib/windows/README.md">contrib on Windows section</a>.</p>

SEE ALSO

clihub3/4/2026HURL(1)