Skip to content
Latchkey

hurl: Run HTTP Requests from a Plain-Text File

hurl file.hurl executes the requests written in a plain-text .hurl file and prints the last response body.

Hurl defines HTTP requests, and optionally their expected responses, in a readable text format. Running the file executes the requests in order, making it a natural fit for versioned API smoke tests.

What it does

hurl reads a .hurl file where each entry is a method and URL, optional headers, an optional request body, and an optional expected-response section. It runs the entries top to bottom, following captures and asserts, and by default prints the body of the last response to stdout.

Common usage

Terminal
hurl smoke.hurl
hurl --location smoke.hurl            # follow redirects
hurl --output result.json api.hurl
hurl --verbose smoke.hurl             # show request/response detail

Options

FlagWhat it does
<file>.hurlThe Hurl file to execute
--location, -LFollow HTTP redirects
--output, -o <file>Write the last response body to a file
--verbosePrint request and response details
--connect-timeout <sec>TCP connection timeout

In CI

A .hurl file lives in the repo next to the code it tests, so smoke tests are reviewed and versioned like everything else. For assertions and a JUnit-style report, run with --test (covered separately). By default hurl does not follow redirects, so add --location for endpoints that redirect.

Common errors in CI

error: Failed to connect to <host> port <port>: Connection refused means the service is not up; gate hurl behind a readiness wait. A parse error like error: Parsing method points at malformed syntax in the .hurl file (wrong method, missing blank line between entries). error: SSL certificate problem mirrors curl's TLS errors, since Hurl uses libcurl.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →