Update docs on Content-Encoding not affecting captures.

This commit is contained in:
Jean-Christophe Amiel 2025-07-29 08:50:23 +02:00
parent 568d8fbd00
commit 9c3096eb6a
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
2 changed files with 15 additions and 2 deletions

View File

@ -406,7 +406,7 @@ Predicates consist of a predicate function and a predicate value. Predicate func
| __`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 | `ip isUuid` |
| __`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`)
@ -998,4 +998,5 @@ certificate "Serial-Number" matches "[0-9af]+"
[`Content-Encoding` HTTP header]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
[`Content-Type` header]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
[`body` assert]: #body-assert
[`location` filter]: /docs/filters.md#location
[`location` filter]: /docs/filters.md#location
[UUID v4]: https://en.wikipedia.org/wiki/Universally_unique_identifier

View File

@ -27,6 +27,13 @@ X-CSRF-TOKEN: {{csrf_token}}
HTTP 302
```
Body responses can be encoded by server (see [`Content-Encoding` HTTP header]) but captures in Hurl files are not
affected by this content compression. All body captures (`body`, `bytes`, `sha256` etc...) work _after_ content decoding.
Finally, body text captures (`body`, `jsonpath`, `xpath` etc...) are also decoded to strings based on [`Content-Type` header]
so these queries can be captures as usual strings.
Structure of a capture:
<div class="schema-container schema-container u-font-size-2 u-font-size-3-sm">
@ -166,6 +173,8 @@ HTTP 200
my_body: bytes decode "gb2312"
```
`body` capture works _after_ content encoding decompression (so the captured value is not affected by `Content-Encoding` response header).
### Bytes capture
Capture the entire body (as a raw bytestream) from the received HTTP response
@ -177,6 +186,9 @@ HTTP 200
my_data: bytes
```
Like `body` capture, `bytes` capture works _after_ content encoding decompression (so the captured value is not
affected by `Content-Encoding` response header).
### XPath capture
Capture a [XPath] query from the received HTTP body decoded as a string.