Hi, Is there a documentation on stubbing `applicat...
# wiremock-java
o
Hi, Is there a documentation on stubbing
application/x-www-form-urlencoded
request?
r
What is it you need to do? You can match on the
Content-Type
header & the body:
Copy code
stubFor(
  get(urlEqualTo("/some/thing"))
    .withHeader("Content-Type", equalTo("application/x-www-form-urlencoded"))
    .withRequestBody(containing("foo=bar"))
    .willReturn(aResponse())
);
If you need to use the values in the response have a look at "Form helper" under https://wiremock.org/docs/response-templating/ .
There aren't any form specific matchers but it might be nice to add them - something like:
Copy code
.withRequestBody(
  matchingFormKey("foo", equalTo("bar))
)
You could have a look at
MatchesJsonPathPattern
as an example of how to do it.