Hello,
I make HTTP requests to a service where success is indicated by either 200 or 204 (no content). I parse the response using jsonPath, however, as expected this fails when the status is 204. How can I switch on the status, save it as a session variable and only parse the response body when the status is 200?
val scn = scenario("Users Pool 1") .feed(<feeder>) .exec( http("Request 1") .post(<url>) .headers(<headers>) .body(ELFileBody("bodies/request_body.tpl")) // I need the equivalent of "if status == 200 do" here. // I also want to store the http status for later. .check(status.in(200 to 204)) .check(jsonPath("$.id").saveAs("resA")) .check(jsonPath("$.xxx[0].y[0].z").saveAs("resB")) .check(jsonPath("$.xxx[0].y[0].v").ofType[Float].saveAs("resC")) ) // doIf exec based on previous call
Thank you,
Gatling version is 2.1.4