Is it possible to test downloading file #2078
Answered
by
jcamiel
finlaydotb
asked this question in
Q&A
-
|
As the title says, it is possible to test an endpoint that has content disposition as attachment, ie an endpoint that prompts a download of a file? |
Beta Was this translation helpful? Give feedback.
Answered by
jcamiel
Oct 21, 2023
Replies: 1 comment
-
|
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: With an Hurl file, you can test that the header # 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="(.*)"/
# Do the download!
GET https://foo.com/{{file}}
HTTP 200
Content-Length: 23456 # somple implicit test on headersYou can also simulate uploading files with |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
finlaydotb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
With an Hurl file, you can test that the header
Content-Dispositionhas the right value. You can also extract the filename and make sur that you can download the file: