So I’m trying to use wiremock to make a post request to a Url with a request body and then get a response back with my respons.json file.(custom response )
This is how I have it set but I can’t seem to find any info on how to set a post stub with request body(containing data let’s say trying to create ID) and then retrieve a custom response body(created Id response from the json file). How would I set that up. I’m trying to make a request to make id through a json file and then trying to retrieve that created Id .
public void exactUrlOnly() {
stubFor(post(urlEqualTo("/some/thing"))
.willReturn(aResponse()
.withHeader("Content-Type", "text/plain")
.withBodyFile("Hello /world!")));
The WithBodyFile is that the response that’s suppose to be returned ? or is that the request body? I want to somehow put my request body before I start the willReturn line. Basically send a request in with a json file and then get the response from another json file