Search code examples
jax-rswildflyrest-assured

how to see actual body sent from restassured


I have created a jax-rs rest api and tested it with rest-assured. All tests are green. Now I am trying to create an html/js front end for it.

My problem is I do not know how my json objects should look like to be accepted by my rest api. Thanks to restassured/jax-rs I never handled request strings. I fill in objects and I get objects, (un)marshaling (json) is invisible.

Is there any way I can see (debug) what strings are created by rest-assured/java and sent over the "wire"?


Solution

  • If you want to log the request body you can do:

    given().log().body(). ..
    

    Or if you want to log the response body you can do:

    .. .then().log().body(). ..
    

    See documentation on logging for more details.