Having Problems with saveAs

Hi everyone, im new to Gatling and can’t figure out how to get “saveAs” to work the way i want.
I’m trying to save variables form one response and use them in the next request.

import scala.concurrent.duration._

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._

class demo extends Simulation {

var idToken = “”
var clientID = “”

val httpProtocol = http
.proxy(Proxy(“proxy.placeholder.com”, 88).httpsPort(88))

val headers_GetAccessToken_App_0 = Map(
“Accept” → “application/json”,
“Accept-Encoding” → “gzip,deflate”,
“Content-Type” → “application/json”

val headers_GetAccessToken_App_1 = Map(
“Accept” → “application/json”,
“Accept-Encoding” → “gzip,deflate”,
“Content-Type” → “application/json”

val headers_GetAccessToken_App_2 = Map(
“Accept-Charset” → “UTF-8”,
“Accept” → “application/json”,
“Accept-Encoding” → “gzip,deflate”,
“Content-Type” → “application/json”

val GetAccessToken_App_0 = scenario(“GetAccessToken_App_0”)
.header(“x-client-id”, “${clientID}”)


I get: “Failed to build request request_GetAccessToken_App_2: No Attribute named ‘idToken’ is defined” as an error when I run the simulation and can’t seem to find out how to fix it.

Thanks in advance,

PS: ignore the URLs, they have been changed to omit sensitive information

Hi Wolfgang,
You need to use quotes around the attribute name (saveAs param):


And no need to have a variable for that.

Hi Julia,

thanks for the quick answer. It seems to work, though I can’t really say since the servers I’m testing on are down atm. :frowning:

thanks a lot,

PS: for being such an easy fix I wasted way too much time on this :slight_smile: