diff --git a/README.md b/README.md index 77a05b5d8e..4623a727cc 100644 --- a/README.md +++ b/README.md @@ -708,6 +708,7 @@ screencapability: low HTTP 200 [Asserts] jsonpath "$.validated" == true +jsonpath "$.userInfo" isObject jsonpath "$.userInfo.firstName" == "Franck" jsonpath "$.userInfo.lastName" == "Herbert" jsonpath "$.hasDevice" == false @@ -1520,14 +1521,15 @@ Environment variables can only be specified in lowercase. Using an environment variable to set the proxy has the same effect as using the [`-x, --proxy`](#proxy) option. -| Variable | Description | -|--------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `http_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use for HTTP.
| -| `https_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use for HTTPS.
| -| `all_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use if no protocol-specific proxy is set.
| -| `no_proxy ` | List of host names that shouldn't go through any proxy.
| -| `HURL_name value` | Define variable (name/value) to be used in Hurl templates. This is similar than [`--variable`](#variable) and [`--variables-file`](#variables-file) options.
| -| `NO_COLOR` | When set to a non-empty string, do not colorize output (see [`--no-color`](#no-color) option).
| +| Variable | Description | +|--------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `http_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use for HTTP.
| +| `https_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use for HTTPS.
| +| `all_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use if no protocol-specific proxy is set.
| +| `no_proxy ` | List of host names that shouldn't go through any proxy.
| +| `HURL_VARIABLE_name value` | Define variable (name/value) to be used in Hurl templates. This is similar to [`--variable`](#variable) and [`--variables-file`](#variables-file) options.
| +| `HURL_SECRET_name value` | Define secret (name/value) to be used in Hurl templates. This is similar to [`--secret`](#secret) and [`--secrets-file`](#secrets-file) options.
| +| `NO_COLOR` | When set to a non-empty string, do not colorize output (see [`--no-color`](#no-color) option).
| ## Exit Codes diff --git a/docs/asserting-response.md b/docs/asserting-response.md index e8611fd3b9..f22eea94ca 100644 --- a/docs/asserting-response.md +++ b/docs/asserting-response.md @@ -383,30 +383,31 @@ sizes. Predicates consist of a predicate function and a predicate value. Predicate functions are: -| Predicate | Description | Example | -|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------| -| __`==`__ | Query and predicate value are equal | `jsonpath "$.book" == "Dune"` | -| __`!=`__ | Query and predicate value are different | `jsonpath "$.color" != "red"` | -| __`>`__ | Query number or date is greater than predicate value | `jsonpath "$.year" > 1978`

`jsonpath "$.createdAt" toDate "%+" > {{ a_date }}` | -| __`>=`__ | Query number or date is greater than or equal to the predicate value | `jsonpath "$.year" >= 1978` | -| __`<`__ | Query number or date is less than that predicate value | `jsonpath "$.year" < 1978` | -| __`<=`__ | Query number or date is less than or equal to the predicate value | `jsonpath "$.year" <= 1978` | -| __`startsWith`__ | Query starts with the predicate value
Value is string or a binary content | `jsonpath "$.movie" startsWith "The"`

`bytes startsWith hex,efbbbf;` | -| __`endsWith`__ | Query ends with the predicate value
Value is string or a binary content | `jsonpath "$.movie" endsWith "Back"`

`bytes endsWith hex,ab23456;` | -| __`contains`__ | If query returns a collection of string or numbers, query collection includes the predicate value (string or number)
If query returns a string or a binary content, query contains the predicate value (string or bytes) | `jsonpath "$.movie" contains "Empire"`

`bytes contains hex,beef;`

`jsonpath "$.numbers" contains 42` | -| __`matches`__ | Part of the query string matches the regex pattern described by the predicate value (see [regex syntax](https://docs.rs/regex/latest/regex/#syntax)) | `jsonpath "$.release" matches "\\d{4}"`

`jsonpath "$.release" matches /\d{4}/` | -| __`exists`__ | Query returns a value | `jsonpath "$.book" exists` | -| __`isBoolean`__ | Query returns a boolean | `jsonpath "$.succeeded" isBoolean` | -| __`isCollection`__ | Query returns a collection | `jsonpath "$.books" isCollection` | -| __`isEmpty`__ | Query returns an empty collection | `jsonpath "$.movies" isEmpty` | -| __`isFloat`__ | Query returns a float | `jsonpath "$.height" isFloat` | -| __`isInteger`__ | Query returns an integer | `jsonpath "$.count" isInteger` | -| __`isIsoDate`__ | Query string returns a [RFC 3339] date (`YYYY-MM-DDTHH:mm:ss.sssZ`) | `jsonpath "$.publication_date" isIsoDate` | -| __`isNumber`__ | Query returns an integer or a float | `jsonpath "$.count" isNumber` | -| __`isString`__ | Query returns a string | `jsonpath "$.name" isString` | -| __`isIpv4`__ | Query returns an IPv4 address | `ip isIpv4` | -| __`isIpv6`__ | Query returns an IPv6 address | `ip isIpv6` | -| __`isUuid`__ | Query returns a [UUID v4] | `ip isUuid` | +| Predicate | Description | Example | +|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------| +| __`==`__ | Query and predicate value are equal | `jsonpath "$.book" == "Dune"` | +| __`!=`__ | Query and predicate value are different | `jsonpath "$.color" != "red"` | +| __`>`__ | Query number or date is greater than predicate value | `jsonpath "$.year" > 1978`

`jsonpath "$.createdAt" toDate "%+" > {{ a_date }}` | +| __`>=`__ | Query number or date is greater than or equal to the predicate value | `jsonpath "$.year" >= 1978` | +| __`<`__ | Query number or date is less than that predicate value | `jsonpath "$.year" < 1978` | +| __`<=`__ | Query number or date is less than or equal to the predicate value | `jsonpath "$.year" <= 1978` | +| __`startsWith`__ | Query starts with the predicate value
Value is string or a binary content | `jsonpath "$.movie" startsWith "The"`

`bytes startsWith hex,efbbbf;` | +| __`endsWith`__ | Query ends with the predicate value
Value is string or a binary content | `jsonpath "$.movie" endsWith "Back"`

`bytes endsWith hex,ab23456;` | +| __`contains`__ | If query returns a collection of string or numbers, query collection includes the predicate value (string or number)
If query returns a string or a binary content, query contains the predicate value (string or bytes) | `jsonpath "$.movie" contains "Empire"`

`bytes contains hex,beef;`

`jsonpath "$.numbers" contains 42` | +| __`matches`__ | Part of the query string matches the regex pattern described by the predicate value (see [regex syntax](https://docs.rs/regex/latest/regex/#syntax)) | `jsonpath "$.release" matches "\\d{4}"`

`jsonpath "$.release" matches /\d{4}/` | +| __`exists`__ | Query returns a value | `jsonpath "$.book" exists` | +| __`isBoolean`__ | Query returns a boolean | `jsonpath "$.succeeded" isBoolean` | +| __`isEmpty`__ | Query returns an empty collection (list, object) | `jsonpath "$.movies" isEmpty` | +| __`isFloat`__ | Query returns a float | `jsonpath "$.height" isFloat` | +| __`isInteger`__ | Query returns an integer | `jsonpath "$.count" isInteger` | +| __`isIpv4`__ | Query returns an IPv4 address | `ip isIpv4` | +| __`isIpv6`__ | Query returns an IPv6 address | `ip isIpv6` | +| __`isIsoDate`__ | Query string returns a [RFC 3339] date (`YYYY-MM-DDTHH:mm:ss.sssZ`) | `jsonpath "$.publication_date" isIsoDate` | +| __`isList`__ | Query returns a list | `jsonpath "$.books" isList` | +| __`isNumber`__ | Query returns an integer or a float | `jsonpath "$.count" isNumber` | +| __`isObject`__ | Query returns an object (JSON object or XML node set) | `jsonpath "$.books[0]" isObject` | +| __`isString`__ | Query returns a string | `jsonpath "$.name" isString` | +| __`isUuid`__ | Query returns a [UUID v4] | `ip isUuid` | Each predicate can be negated by prefixing it with `not` (for instance, `not contains` or `not exists`) diff --git a/docs/frequently-asked-questions.md b/docs/frequently-asked-questions.md index 3badb0b7e8..54a36aeb53 100644 --- a/docs/frequently-asked-questions.md +++ b/docs/frequently-asked-questions.md @@ -239,12 +239,12 @@ $ TOMORROW=$(date '+%y%m%d' -d"+1days") $ hurl --variable "today=$TODAY" --variable "tomorrow=$TOMORROW" test.hurl ``` -You can also use environment variables that begins with `HURL_` to inject data in an Hurl file. +You can also use environment variables that begins with `HURL_VARIABLE_` to inject data in an Hurl file. For instance, to inject `today` and `tomorrow` variables: ```shell -$ export HURL_today=$(date '+%y%m%d') -$ export HURL_tomorrow=$(date '+%y%m%d' -d"+1days") +$ export HURL_VARIABLE_today=$(date '+%y%m%d') +$ export HURL_VARIABLE_tomorrow=$(date '+%y%m%d' -d"+1days") $ hurl test.hurl ``` diff --git a/docs/manual.md b/docs/manual.md index 14be59a68a..16cacb9b32 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -229,14 +229,15 @@ Environment variables can only be specified in lowercase. Using an environment variable to set the proxy has the same effect as using the [`-x, --proxy`](#proxy) option. -| Variable | Description | -|--------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `http_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use for HTTP.
| -| `https_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use for HTTPS.
| -| `all_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use if no protocol-specific proxy is set.
| -| `no_proxy ` | List of host names that shouldn't go through any proxy.
| -| `HURL_name value` | Define variable (name/value) to be used in Hurl templates. This is similar than [`--variable`](#variable) and [`--variables-file`](#variables-file) options.
| -| `NO_COLOR` | When set to a non-empty string, do not colorize output (see [`--no-color`](#no-color) option).
| +| Variable | Description | +|--------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `http_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use for HTTP.
| +| `https_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use for HTTPS.
| +| `all_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use if no protocol-specific proxy is set.
| +| `no_proxy ` | List of host names that shouldn't go through any proxy.
| +| `HURL_VARIABLE_name value` | Define variable (name/value) to be used in Hurl templates. This is similar to [`--variable`](#variable) and [`--variables-file`](#variables-file) options.
| +| `HURL_SECRET_name value` | Define secret (name/value) to be used in Hurl templates. This is similar to [`--secret`](#secret) and [`--secrets-file`](#secrets-file) options.
| +| `NO_COLOR` | When set to a non-empty string, do not colorize output (see [`--no-color`](#no-color) option).
| ## Exit Codes diff --git a/docs/manual/hurl.1 b/docs/manual/hurl.1 index dd97c1a443..3bdc92501a 100644 --- a/docs/manual/hurl.1 +++ b/docs/manual/hurl.1 @@ -1,4 +1,4 @@ -.TH hurl 1 "10 Oct 2025" "hurl 7.1.0-SNAPSHOT" " Hurl Manual" +.TH hurl 1 "10 Nov 2025" "hurl 7.1.0-SNAPSHOT" " Hurl Manual" .SH NAME hurl - run and test HTTP requests. @@ -592,9 +592,13 @@ Sets the proxy server to use if no protocol-specific proxy is set. List of host names that shouldn't go through any proxy. -.IP "HURL_name value" +.IP "HURL_VARIABLE_name value" -Define variable (name/value) to be used in Hurl templates. This is similar than \fI--variable\fP and \fI--variables-file\fP options. +Define variable (name/value) to be used in Hurl templates. This is similar to \fI--variable\fP and \fI--variables-file\fP options. + +.IP "HURL_SECRET_name value" + +Define secret (name/value) to be used in Hurl templates. This is similar to \fI--secret\fP and \fI--secrets-file\fP options. .IP "NO_COLOR" diff --git a/docs/manual/hurl.md b/docs/manual/hurl.md index d5142be8d8..89aa732a01 100644 --- a/docs/manual/hurl.md +++ b/docs/manual/hurl.md @@ -611,9 +611,13 @@ Sets the proxy server to use if no protocol-specific proxy is set. List of host names that shouldn't go through any proxy. -### HURL_name value +### HURL_VARIABLE_name value -Define variable (name/value) to be used in Hurl templates. This is similar than [`--variable`](#variable) and [`--variables-file`](#variables-file) options. +Define variable (name/value) to be used in Hurl templates. This is similar to [`--variable`](#variable) and [`--variables-file`](#variables-file) options. + +### HURL_SECRET_name value + +Define secret (name/value) to be used in Hurl templates. This is similar to [`--secret`](#secret) and [`--secrets-file`](#secrets-file) options. ### NO_COLOR diff --git a/docs/manual/hurlfmt.1 b/docs/manual/hurlfmt.1 index 83a03ef889..96139451c4 100644 --- a/docs/manual/hurlfmt.1 +++ b/docs/manual/hurlfmt.1 @@ -1,4 +1,4 @@ -.TH hurl 1 "10 Oct 2025" "hurl 7.1.0-SNAPSHOT" " Hurl Manual" +.TH hurl 1 "10 Nov 2025" "hurl 7.1.0-SNAPSHOT" " Hurl Manual" .SH NAME hurlfmt - format Hurl files diff --git a/docs/running-tests.md b/docs/running-tests.md index c7bea7b8c8..c63dd5c71f 100644 --- a/docs/running-tests.md +++ b/docs/running-tests.md @@ -333,7 +333,7 @@ To use variables in your tests, you can: - use [`--variable` option] - use [`--variables-file` option] -- define environment variables, for instance `HURL_foo=bar` +- define environment variables, for instance `HURL_VARIABLE_foo=bar` You will find a detailed description in the [Injecting Variables] section of the docs. diff --git a/docs/samples.md b/docs/samples.md index 6fbec28f37..999e8bf7ee 100644 --- a/docs/samples.md +++ b/docs/samples.md @@ -433,6 +433,7 @@ screencapability: low HTTP 200 [Asserts] jsonpath "$.validated" == true +jsonpath "$.userInfo" isObject jsonpath "$.userInfo.firstName" == "Franck" jsonpath "$.userInfo.lastName" == "Herbert" jsonpath "$.hasDevice" == false diff --git a/docs/spec/runner/secrets.md b/docs/spec/runner/secrets.md index 78f199c25b..2991451f10 100644 --- a/docs/spec/runner/secrets.md +++ b/docs/spec/runner/secrets.md @@ -24,9 +24,9 @@ As of Hurl 5.0.1, the way to define variables in Hurl are: id=1234 ``` -- Environment variable prefixed by `HURL_` - export HURL_host=example.net - export HURL_id=1234 +- Environment variable prefixed by `HURL_VARIABLE_` + export HURL_VARIABLE_host=example.net + export HURL_VARIABLE_id=1234 hurl test.hurl - `[Options]` section, inside a Hurl file diff --git a/docs/templates.md b/docs/templates.md index 5ce99a0295..bf3cbf8337 100644 --- a/docs/templates.md +++ b/docs/templates.md @@ -150,7 +150,7 @@ Variables can be injected in a Hurl file: - by using [`--variable` option] - by using [`--variables-file` option] -- by defining environment variables, for instance `HURL_foo=bar` +- by defining environment variables, for instance `HURL_VARIABLE_foo=bar` - by defining variables in an [`[Options]` section][options] Lets' see how to inject variables, given this `test.hurl`: @@ -189,11 +189,11 @@ id=1234 ### Environment variable -We can use environment variables in the form of `HURL_name=value`: +We can use environment variables in the form of `HURL_VARIABLE_name=value`: ```shell -$ export HURL_host=example.net -$ export HURL_id=1234 +$ export HURL_VARIABLE_host=example.net +$ export HURL_VARIABLE_id=1234 $ hurl test.hurl ``` diff --git a/packages/hurl/README.md b/packages/hurl/README.md index 2560ee9593..7d34d9f45e 100644 --- a/packages/hurl/README.md +++ b/packages/hurl/README.md @@ -708,6 +708,7 @@ screencapability: low HTTP 200 [Asserts] jsonpath "$.validated" == true +jsonpath "$.userInfo" isObject jsonpath "$.userInfo.firstName" == "Franck" jsonpath "$.userInfo.lastName" == "Herbert" jsonpath "$.hasDevice" == false @@ -1520,14 +1521,15 @@ Environment variables can only be specified in lowercase. Using an environment variable to set the proxy has the same effect as using the [`-x, --proxy`](#proxy) option. -| Variable | Description | -|--------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `http_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use for HTTP.
| -| `https_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use for HTTPS.
| -| `all_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use if no protocol-specific proxy is set.
| -| `no_proxy ` | List of host names that shouldn't go through any proxy.
| -| `HURL_name value` | Define variable (name/value) to be used in Hurl templates. This is similar than [`--variable`](#variable) and [`--variables-file`](#variables-file) options.
| -| `NO_COLOR` | When set to a non-empty string, do not colorize output (see [`--no-color`](#no-color) option).
| +| Variable | Description | +|--------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `http_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use for HTTP.
| +| `https_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use for HTTPS.
| +| `all_proxy [PROTOCOL://][:PORT]` | Sets the proxy server to use if no protocol-specific proxy is set.
| +| `no_proxy ` | List of host names that shouldn't go through any proxy.
| +| `HURL_VARIABLE_name value` | Define variable (name/value) to be used in Hurl templates. This is similar to [`--variable`](#variable) and [`--variables-file`](#variables-file) options.
| +| `HURL_SECRET_name value` | Define secret (name/value) to be used in Hurl templates. This is similar to [`--secret`](#secret) and [`--secrets-file`](#secrets-file) options.
| +| `NO_COLOR` | When set to a non-empty string, do not colorize output (see [`--no-color`](#no-color) option).
| ## Exit Codes