Failing to set Authorization header

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

`

I’ve just tried with current master and it works as expected:

class Foo extends Simulation {

val httpProtocol = http
.baseURL(“http://gatling.io”)
.authorizationHeader(“FOO”)

val scn = scenario(“Basic”)
.exec(http(“Home”).get("/"))

setUp(scn.inject(atOnceUsers(1)).protocols(httpProtocol))
}

DefaultHttpRequest(chunked: false)
GET / HTTP/1.1
Authorization: FOO
Connection: keep-alive
Host: gatling.io
Accept: /

Could you please upgrade? Latest version is 2.1.2

Thank Stephanie, that works!

I changed to

addSbtPlugin("io.gatling" % "gatling-sbt" % "2.1.0")
libraryDependencies ++= Seq(
  "io.gatling.highcharts" % "gatling-charts-highcharts" % "2.1.2" % "test",
  "io.gatling"            % "gatling-test-framework"    % "2.1.1" % "test"
)
scalaVersion := "2.11.4"

I had been using old versions to be build with scala 2.10 which the new plugin didn’t seem to be compatible with - the versions in my first post were the only ones I found to work.

I believe I can use 2.11 now, so this is my problem solved.

Thanks

Great.

BTW, that’s Stephane (male), not Stephanie (female).

Sorry for the error, thanks again