I’m trying to set an Authorization header in a Gatling Simulation and it doesn’t seem to be working.
I’m running as an SBT project with the following versions:
“io.gatling.highcharts” % “gatling-charts-highcharts” % “2.0.2” % “test”,
“io.gatling” % “test-framework” % “1.0” % “test”
addSbtPlugin(“io.gatling” % “sbt-plugin” % “1.0”)
I have tried setting the Authorization header both with the http protocol config and with the request builder.
`
val httpConf = http.baseURL(baseUrl)
.acceptHeader("application/json")
.authorizationHeader("Bearer ...")
setUp(scn.inject(constantUsersPerSec(100) during (2 seconds))).protocols(httpConf)
def scn = scenario("Call user-devices").exec(http("call_user_devices")
.get("/users/" + userId + "/devices/")
.header(HeaderNames.Authorization, "Bearer ...")
.header(HeaderNames.UserAgent, "MIKE")
.check(
status.is(200),
jsonPath("$[0].id").exists))
`
In the logs, both the User-Agent and Accept headers are set but neither Authorization header is picked up
`
GET /users/97f73a5b-1d12-4f36-94a1-ed7e2b910517/devices/ HTTP/1.1
Accept: application/json
User-Agent: MIKE
`