Skip to content

Is it possible to test downloading file #2078

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

You must be logged in to vote

Hi @finlaydotb

Can you give us more details about waht you want to test?

In any case, if you have an endpoint which is returning the following:

200 OK
Content-Type: text/html; charset=utf-8
Content-Disposition: attachment; filename="cool.html"
Content-Length: 21

<HTML>Save me!</HTML>

With an Hurl file, you can test that the header Content-Disposition has the right value. You can also extract the filename and make sur that you can download the file:

# Test that our page return the right HTTP header and
# capture the file name
GET https://foo.com/download.html
HTTP 200
[Asserts]
header "Content-Disposition" contains "cool.html"
[Captures]
file: header "Content-Disposition" regex /filename…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by finlaydotb
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