You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of karate only returns the status as an int by implementing the method getStatusCode(), as described in the following documentation:
Is there any way to return the status message (by implementing the method getStatusText() to Karate) that comes with the status code? Like 400 = Bad Request, 200 = OK
The given problem is that I've an API that has different status messages for the code 400. I want to differentiate my test cases based on the message that comes with the code.
The text was updated successfully, but these errors were encountered:
and it seems you can call httpResponse.getStatusLine().getReasonPhrase().
in the meantime, I was seeing if you can fallback to curl using this approach: https://stackoverflow.com/a/64352676/143475 - I tried to do some digging if curl can get you the status message, but gave up.
you always have the option of writing some java code that fires up an apache http client and using it via java interop. personally I think these tests for a 400 are not worth it, but if really important - this java interop option is what I would recommend
The current implementation of karate only returns the status as an int by implementing the method getStatusCode(), as described in the following documentation:
https://javadoc.jetbrains.net/teamcity/openapi/current/jetbrains/buildServer/util/HTTPRequestBuilder.Response.html
Is there any way to return the status message (by implementing the method getStatusText() to Karate) that comes with the status code? Like 400 = Bad Request, 200 = OK
The given problem is that I've an API that has different status messages for the code 400. I want to differentiate my test cases based on the message that comes with the code.
The text was updated successfully, but these errors were encountered: