I am trying to send a http request and fail if the request returns not 200:
exec(http("Get some html")
.get("${aggUrl}/somePath")
.check(status.is(200))
.check(regex("websocket=(.*?)&").saveAs("wsLink"))
)
The server sends the 401 response:
[HTTP/1.1 401 Unauthorized]{"errors":[{"code":"authentication.failure","message":"Failed to authenticate user details"}]}]
I expect in console something like "expecting code 200, but was 401"
But the actual error is:
[ERROR] i.g.c.a.b.SessionHookBuilder$$anon$1 - 'hook-38' crashed with 'j.u.NoSuchElementException: No attribute named 'wsLink' is defined', forwarding to the next one
[ERROR] i.g.h.a.HttpRequestAction - 'httpRequest-37' failed to execute: No attribute named 'wsLink' is defined
So I assume that the ".check(status.is(200))" is just ignored?
How then should I fail the test?
Thanks in advance, Andrei Isakov