Hi Team,
I recently started implementing performance testing with Gatling and I think I may have identified a bug.
Below is a code snippet of a sample POST request I’m trying to simulate.
Method calling basic order request:
public static HttpRequestActionBuilder orderEndpointRequest() {
return http("Sending order - /order post ").post("/order")
.header("content-type", "application/json")
.header("Origin", "http://XXXXXXXXXX")
.header("Referer", "http://XXXXXXXXX")
.body(StringBody(orderRequestMap(orderID, amount, description)))
.check(header("content-type").saveAs("content"))
.check(header("Referer").saveAs("referer"))
.check(header("Origin").saveAs("origin"))
.check(status().is(200))
}
ScenarioBuilder request
private final ScenarioBuilder sendOrderRequest = scenario(" Order Request")
.exec(orderEndpointRequest())
.exec(session -> {
System.out.println( "This is the content type: " + session.getString("content"));
System.out.println( "This is the referer: " + session.getString("referer"));
System.out.println( "This is the origin: " + session.getString("origin"));
return session;
});
{
setUp(sendOrderRequest.injectOpen(rampUsers(1).during(5))).protocols(httpProtocol);
}
The output is as follows:
This is the content type: application/json;charset=UTF-8
This is the referer: null
This is the origin: null
The issue I’m seeing is for the following referrers origin and header why are they showing up as null?, despite passing them in orderEndpointRequest method. Is this a bug or am I doing something wrong?
A version of gatling I have in pom.xml
<gatling-maven-plugin.version>**4.5.0**</gatling-maven-plugin.version>
<gatling.version>**3.9.5**</gatling.version>