How to ensure a pdf is downloaded during a loadtest?


I have a script where two requests are triggered when I mimic click on a download button. Manually if I do it in UI it works fine and the file is downloaded into my local. However, if
I try the same via script gatling shows everything works fine but the file is not present in my local.

The two requests are as follows:

http(“S3.1 - get.php download simple”)
.formParam(“action”, “111”)
.formParam(“fileId”, “${simpleFileId}”)
.formParam(“flowId”, “${testId}”)
.formParam(“csrfId”, “${csrfId}”)

http(“S3.2 - newset.php action 308 simple”)
.formParam(“flowId”, “${testId}”)
.formParam(“action”, “308”)
.formParam(“csrfId”, “${csrfId}”)

I did some reading related to other performance tools and it suggests setting response headers content-disposition: attachment or content-type: pdf/application. However, in the application Is there a way by which I can save the response header and change it so that the file will get downloaded? For the new header do I need to send a fresh request?
Thanks in advance

Hi Reetu,

How did you achieve this? I have a same scenario. If someone can post solution that would be more helpfull.


I am trying to achieve similar scenario with my application.
Did you find the solution for this.


Hi all!

You can try bodyBytes or bodyStream in the check section.


Below you have Example in Java:

import io.gatling.javaapi.core.ScenarioBuilder;
import io.gatling.javaapi.core.Simulation;
import io.gatling.javaapi.http.HttpProtocolBuilder;

import static io.gatling.javaapi.core.CoreDsl.*;
import static io.gatling.javaapi.http.HttpDsl.http;

public class PDFdownloadSimulation extends Simulation {

    HttpProtocolBuilder httpProtocol =

    ScenarioBuilder scn =
            scenario("Scenario Name")


Hi all,
I send a (.json) request from gatling script which in response downloads the file.

I have logback.xml settings to capture this response in a log file. Here, I could see the file contents are derived as part of the session value in a List in a Log file. This confirms the file is downloaded with each user request.

My query is, how could we get the physical file on the disk or in downloads folders with each iteration.

Appreciate your support.


Since you receive your content, you can write it on file.

I’m curious, why do you need your files on disk? As Gatling is a load testing tool, at high usage your disk will be empty (and performance of writing on disk is very poor)

Sure, Thanks for the update.

Basically, I had run similar scenario in JMeter, there we used plugin “Save Responses to a file” which was able to download .pdf file and save to bin folder. So I was thinking if we have something similar in Gatling.