Hello, can i make wiremock to include in recording...
# help
v
Hello, can i make wiremock to include in recordings the whole request (the query params, request body etc) rather than just the hash of the request
i need to achieve this programatically. This is how my recording spec looks like currently.
var spec = new RecordSpec(
null,
null,
headers,
(r -> new RegexPattern(".*")),
null,
SnapshotOutputFormatter._FULL_,
false,
true,
null,
null
);
May be i am missing something but otherwise, i don't find any option here to include the whole request in the recording.
wiremock i am using is
org.springframework.cloud:spring-cloud-contract-wiremock:4.0.4
i am not so expert in wiremock. May be ``RecordSpec'` supports it but i am not sure how to configure it to record the whole request.
@Tom - would you mind helping with above or refer this to someone who can help.
removing ``(r -> new RegexPattern(".*")),`` did the trick
t
WireMock already captures query parameters for GETs and the body when it’s a POST/PUT. Capturing all headers is a bad idea as this will over-constrain your stubs. Can you share what ultimate goal you’re trying to achieve here?
v
@Tom - thanks for your guidance... i could figure it out. Like you said the default behavior of wiremock is to capture the request body but my code overwrote it with
(r -> new RegexPattern(".*"))
, i changed this to null and it started recording the whole request body. thanks for developing and helping with this amazing framework.
t
Glad you figured it out!