Skip to content

Commit

Permalink
Update Hurl snippet in doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcamiel committed Jan 10, 2025
1 parent 34f5899 commit e7f9708
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/asserting-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ after this delimiter, you'll find the implicit asserts, then an `[Asserts]` sect
```hurl
GET https://example.org/api/cats
HTTP 200
Content-Type: application/json; charset=utf-8 # Implicit assert on Content-Type Header
[Asserts] # Explicit asserts section
# Implicit assert on `Content-Type` Header
Content-Type: application/json; charset=utf-8
[Asserts]
# Explicit asserts section
bytes count == 120
header "Content-Type" contains "utf-8"
jsonpath "$.cats" count == 49
Expand All @@ -21,6 +23,7 @@ jsonpath "$.cats[0].lives" == 9

Body responses can be encoded by server (see [`Content-Encoding` HTTP header]) but asserts in Hurl files are not
affected by this content compression. All body asserts (`body`, `bytes`, `sha256` etc...) work _after_ content decoding.

Finally, body text asserts (`body`, `jsonpath`, `xpath` etc...) are also decoded to strings based on [`Content-Type` header]
so these asserts can be written with usual strings.

Expand Down

0 comments on commit e7f9708

Please sign in to comment.