You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|__`==`__| Query and predicate value are equal |`jsonpath "$.book" == "Dune"`|
401
401
|__`!=`__| Query and predicate value are different |`jsonpath "$.color" != "red"`|
402
-
|__`>`__| Query number is greater than predicate value |`jsonpath "$.year" > 1978`|
403
-
|__`>=`__| Query number is greater than or equal to the predicate value|`jsonpath "$.year" >= 1978`|
404
-
|__`<`__| Query number is less than that predicate value|`jsonpath "$.year" < 1978`|
405
-
|__`<=`__| Query number is less than or equal to the predicate value|`jsonpath "$.year" <= 1978`|
402
+
|__{% raw %}`>`__| Query number or date is greater than predicate value |`jsonpath "$.year" > 1978`<br><br>`jsonpath "$.createdAt" toDate "%+" > {{ a_date }}`{% endraw %}|
403
+
|__`>=`__| Query number or date is greater than or equal to the predicate value |`jsonpath "$.year" >= 1978`|
404
+
|__`<`__| Query number or date is less than that predicate value |`jsonpath "$.year" < 1978`|
405
+
|__`<=`__| Query number or date is less than or equal to the predicate value |`jsonpath "$.year" <= 1978`|
406
406
|__`startsWith`__| Query starts with the predicate value<br>Value is string or a binary content |`jsonpath "$.movie" startsWith "The"`<br><br>`bytes startsWith hex,efbbbf;`|
407
407
|__`endsWith`__| Query ends with the predicate value<br>Value is string or a binary content |`jsonpath "$.movie" endsWith "Back"`<br><br>`bytes endsWith hex,ab23456;`|
408
408
|__`contains`__| If query returns a collection of string or numbers, query collection includes the predicate value (string or number)<br>If query returns a string or a binary content, query contains the predicate value (string or bytes) |`jsonpath "$.movie" contains "Empire"`<br><br>`bytes contains hex,beef;`<br><br>`jsonpath "$.numbers" contains 42`|
409
-
|__`matches`__| Part of the query string matches the regex pattern described by the predicate value |`jsonpath "$.release" matches "\\d{4}"`<br><br>`jsonpath "$.release" matches /\d{4}/`|
409
+
|__`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}"`<br><br>`jsonpath "$.release" matches /\d{4}/`|
410
410
|__`exists`__| Query returns a value |`jsonpath "$.book" exists`|
411
411
|__`isBoolean`__| Query returns a boolean |`jsonpath "$.succeeded" isBoolean`|
412
412
|__`isCollection`__| Query returns a collection |`jsonpath "$.books" isCollection`|
@@ -418,10 +418,7 @@ Predicates consist of a predicate function and a predicate value. Predicate func
418
418
|__`isString`__| Query returns a string |`jsonpath "$.name" isString`|
419
419
|__`isIpv4`__| Query returns an IPv4 address |`ip isIpv4`|
420
420
|__`isIpv6`__| Query returns an IPv6 address |`ip isIpv6`|
421
-
422
-
Query contains the predicate value if query returns a collection of string or numbers<br>
423
-
Query
424
-
421
+
|__`isUuid`__| Query returns a UUID |`ip isUuid`|
425
422
426
423
427
424
Each predicate can be negated by prefixing it with `not` (for instance, `not contains` or `not exists`)
@@ -843,6 +840,16 @@ captured group value. When the regex pattern is a double-quoted string, metachar
843
840
pattern (like `\d`, `\s`) must be escaped; literal pattern enclosed by `/` can also be used to avoid metacharacters
844
841
escaping.
845
842
843
+
The regex syntax is documented at <https://docs.rs/regex/latest/regex/#syntax>. For instance, once can use [flags](https://docs.rs/regex/latest/regex/#grouping-and-flags)
844
+
to enable case-insensitive match:
845
+
846
+
```hurl
847
+
GET https://example.org/hello
848
+
HTTP 200
849
+
[Asserts]
850
+
regex /(?i)hello (\w+)!/ == "World"
851
+
```
852
+
846
853
### SHA-256 assert
847
854
848
855
Check response body [SHA-256] hash.
@@ -902,6 +909,24 @@ HTTP 200
902
909
url == "https://example.org/redirected"
903
910
```
904
911
912
+
### Redirects assert
913
+
914
+
Check each step of redirection. This is most meaningful if you have told Hurl to follow redirection (see [`[Options]`section][options] or
915
+
[`--location` option]). Redirects assert consists of the keyword `redirects` followed by a predicate function and value. The `redirects`
916
+
query returns a collection of redirections that can be tested with a [`location` filter]:
The regex pattern must have at least one capture group, otherwise the
301
302
capture will fail. When the pattern is a double-quoted string, metacharacters beginning with a backslash in the pattern
302
-
(like `\d`, `\s`) must be escaped; literal pattern enclosed by `/` can also be used to avoid metacharacters escaping.
303
+
(like `\d`, `\s`) must be escaped; literal pattern enclosed by `/` can also be used to avoid metacharacters escaping.
304
+
305
+
The regex syntax is documented at <https://docs.rs/regex/latest/regex/#syntax>. For instance, one can use [flags](https://docs.rs/regex/latest/regex/#grouping-and-flags)
306
+
to enable case-insensitive match:
307
+
308
+
```hurl
309
+
GET https://example.org/hello
310
+
HTTP 200
311
+
[Captures]
312
+
word: regex /(?i)hello (\w+)!/
313
+
```
303
314
304
315
### SHA-256 capture
305
316
@@ -343,6 +354,25 @@ HTTP 200
343
354
landing_url: url
344
355
```
345
356
357
+
### Redirects capture
358
+
359
+
Capture each step of redirection. This is most meaningful if you have told Hurl to follow redirection (see [`[Options]`section][options] or
360
+
[`--location` option]). Redirects capture consists of a variable name, followed by a `:`, and the keyword `redirects`.
361
+
Redirects query returns a collection so each step of the redirection can be capture.
362
+
363
+
```hurl
364
+
GET https://example.org/redirecting/1
365
+
[Options]
366
+
location: true
367
+
HTTP 200
368
+
[Asserts]
369
+
redirects count == 3
370
+
[Captures]
371
+
step1: redirects nth 0 location
372
+
step2: redirects nth 1 location
373
+
step3: redirects nth 2 location
374
+
```
375
+
346
376
### IP address capture
347
377
348
378
Capture the IP address of the last connection. The value of the `ip` query is a string.
0 commit comments