object GetUserDataRequest extends BaseRequest {
val getUserDataRequestScenario = scenario("Get User Data Request")
.feed(csv("get_user_data_request.csv").random)
.exec(session => { val payload : String = ""
val requestType : String = "GET"
val uri : String = "/services/userids/${userid}"
val newSession : Session = session.set("payload", payload)
.set("requestType", requestType)
.set("uri", uri)
.set("signatureCalculator", new CustomSignatureCalculator(payload, requestType, uri, MainController.environment))
.set("contentMd5", Authorization.getMD5MessageDigest(payload))
newSession})
.exec(http("get_user_data_request")
.get("${uri}")
.headers(baseHeader)
.header(HttpHeaderNames.ContentMD5, "${contentMd5}")
.signatureCalculator("${signatureCalculator}")
.check(
status.is(200), bodyString.transform(string => string).saveAs("responseBody")))
.exec(session => { println(session("responseBody").as[String])
session})
}
I need to replace the value of ${userid} with a value coming in from an external CSV file from the feed statement. The way it is written now the request that is being made is not replacing the ${userid} parameter with it's proper value and the request looks like this:
I need that replacement to happen in the exec where I am generating the new session as I need that uri and payload to have any ${} values replaced before I can generate the MD5 and Signature Calculator.
How can I get the ${userid} value replaced in the exec statement? Is this possible?
Sorry for the rambling. This is difficult to explain in a short email. :-)