In Gatling how do I proceed to extract or get and save the Url parameters from response body? I make a post request and as response body a I got a link with parameters (pstId & autId) that I would like to extract and save them:
/**** HTTP Calls ****/
def getResource() = {
exec(
http("psu initiates payment")
.post("/v1/payments/pain.001-sepa-credit-transfers/")
.headers(Map("x-request-id" -> "UUID.randomUUID()", "usp": -> "8975" ))
.body(ElFileBody(XML_FILE_BODY)).asXml
.check(jsonPath("$._links[:1].linkRedirect").find.transform({s => pstId = s; s}).saveAs("pstId"))
.check(jsonPath("$._links[:1].linkRedirect").find.transform({s => autId = s; s}).saveAs("autId"))
)
}
the structure of the response look like:
{
"_links": {
"linkRedirect": "http://localhost:8200/pis?pstId=G0w6I2OTaPFlwzU19xk1dRqwmVyHOw0xIA3YvYQiBEeoJDY7Bl-O1-YQfSBdw5ZIGdR5pO_&autId=c27aad0e-7c9c6f465237",
"scaOAuth": null,
"selectId": null
}
Thank you for sharing you ideas and knowledge with me.