Is there a way to capture the body of a post request that was stubbed with wiremock? I'm looking for something similar to Mockito's ArgumentCaptor
.
I have the following stub:
stubFor(post(urlPathEqualTo(getUploadEndpoint())).willReturn(().withStatus(HttpStatus.OK.value())));
I want to be able to see how the actual request was performed, get its body and assert it.
I have tried by using .withRequestBody(equalToXml(...))
in the stub, since the body is the String representation of an XML. This does not work for me, because equalToXml
is too strict, not allowing free text without surrounding tags for example.