log().ifError() is not printing the response body in case of failure
See original GitHub issueI’ve below code
@Test(timeout=10000)
public void test_xxxx_endpoint(){
given().
log().all().
header("Accept", "application/json; version=1.0").
header("Authorization", "JWT "+ token ).
when().
get(urlValue +"/transitions/").
then().
statusCode(200).
//log().all(). this also has same issue
log().ifError().
time(lessThan(maxResponseTime), TimeUnit.MILLISECONDS);
}
When the response is not 200, it doesn’t print the response body instead I get exception throw.
Please review
Issue Analytics
- State:
- Created 7 years ago
- Comments:5
Top Results From Across the Web
REST Assured Log Response if Error or Status Code Matches ...
If you're only interested in printing the response body if an error occur then you can use: .log().ifError() make sure you are using...
Read more >How to log Request only if response contains an HTTP error ...
I've tried these snippets but end up with ALL requests logged and only the error responses logged. The problem is that my log...
Read more >Logging in Rest Assured ( Response Logging ) - Part 2
body() to the response you'll receive information about what the server sends in the response body. It will log the response even if...
Read more >Log if Error or if the status code matches some value - YouTube
If you're only interested in printing the response body if an error occur then you can use:
Read more >Error, IfError, IsError, and IsBlankOrError functions in Power ...
Error, IfError, IsError, IsBlankOrError functions in Power Apps ... IsError( Blank() ), The argument is a blank, but not an error. false.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You need to place logging before you start your assertions, i.e. before
statusCode(..)
Dont find log().ifFailure() at all… Is it log().ifValidationFails()