Right now on an http() action you can add .check() to validate if the response has specific data (e.g. status, headers, response body). There is a number of cases where you need to extract data from the response but don’t want to “check” it. It would be more intuitive if there was a .extract() available to do just that.
Here is how we currently have to code it:
http("Search").post("/event/search").body("""{"something":"value"}""").asJSON.check(status.is(200)).check(jsonPath("$.events[*].id").find.dontValidate.saveAs("id"))
There are cases where the response is 200 OK but there is no events returned as the search returned no result. For the longest time I didn’t realize I could add a .dontValidate to the find so that it doesn’t error. If I didn’t have the .dontValidate then I would get this in the logs:
Request 'Search' failed: jsonPath($.events[*].id).exists, found nothing
I was looking around in the docs for something where I could “extract” data. What would be best is something like:
http("Search").post("/event/search").body("""{"something":"value"}""").asJSON.check(status.is(200)).extract(jsonPath("$.events[*].id").find, "id")
Does this seem like a reasonable ask? Is there any other way to do it so that I don’t have to “check” the value?