Gatling version: 3.13.1
Gatling flavor: java kotlin scala javascript typescript
Gatling build tool: maven gradle sbt bundle npm
Maven Version : Apache Maven 3.9.9
Java Version : JDK 11.0.25 (Adoptium OpenJDK Windows x64)
OS : Windows 11
I have defined some headers I want to pass in my HTTP request. However, I want to set 1 of the headers based on a value read from a CSV file in my resources directory:
private Map<CharSequence, String> headers = Map.ofEntries(
Map.entry("Accept", "application/json"),
Map.entry("Custom-Value", "some value I want to read from a file")
);
HttpProtocolBuilder httpProtocol =
http.baseUrl("https://my-service.url.com")
.contentTypeHeader("application/json");
ScenarioBuilder myFirstScenario = scenario("My First Scenario")
.exec(http("Request 1")
.post("/service/myapi")
.headers(headers)
);
{
setUp(
myFirstScenario.injectOpen(constantUsersPerSec(2).during(60))
).protocols(httpProtocol);
}
I have tried to use a Feeder but not really making any progress. Please note that I only need the value once, & will use the same header value in every invocation.