Issue with passing request headers

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>

Are you sure that your request succeeds (no IO exception, 200 response status)?

Yes, this is my console output

================================================================================
2023-11-13 10:49:10 0s elapsed
---- Requests ------------------------------------------------------------------

Global (OK=0 KO=1 )
Sending order - /order post (OK=0 KO=1 )
---- Errors --------------------------------------------------------------------
header(Referer).find.exists, found nothing 1 (100.0%)

Referer and Origin are request headers, not response ones. header checks are applied on the response headers. These 2 checks can’t possibly work.

okay, that makes sense, thanks for the clarification. This issue can be closed off :slightly_smiling_face: