Skip to content

Is it possible to assert on a list of response headers #2123

Answered by jcamiel
cesarsaenz asked this question in Q&A
Discussion options

You must be logged in to vote

Maybe you can use filters, that allows you to transform data.
In this sample,

# Using an intermediate variable
GET http://localhost:8000/assert-header
HTTP 200
[Captures]
my_headers: header "Foo"
[Asserts]
variable "my_headers" nth 1 == "baz"

nth is a filter that extract the nth element of a list. There is a blog post introducing filters with more example here https://hurl.dev/blog/2023/01/25/hurl-2.0.0-the-graphql-edition.html#processing-data-with-filters:

GET https://example.org/api
HTTP 200
[Asserts]
header "x-servers" split "," count == 2
header "x-servers" split "," nth 0 == "rec1.org"
header "x-servers" split "," nth 1 == "rec3.org"
jsonpath "$.books" count == 12

split allows you …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@cesarsaenz
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by jcamiel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants