I'd like to match distinct bodies for the same PUT URL, but stubby4j always matches the first case, no matter what's the content of the body.
Example:
- request:
url: /individuals/.*/address$
method: PUT
body: >
{
"type": "MOBILE",
(other input fields)
}
response:
status: 400
body: >
{
"type": "BAD_REQUEST",
"message": "Validation error on request."
}
- request:
url: /individuals/.*/address$
method: PUT
body: >
{
"type": "HOME",
(other input fields)
}
response:
status: 200
In this case, no matter what's the value of the parameter "type" in my request, it always matches with the first stub.
Apologies for the late response.
In the recent & current versions of stubby4j (i.e.:
7.x.x
) it is possible to match distinct bodies for the samePUT
/GET
/POST
/PATCH
/etc URLs.For example, the following is a valid YAML config that would work (I simplified a tad the YAML config provided by the OP for the sake of example):
To note:
request
does not get thebody
key, usepost
key instead for stubbing your payload for POST/PUT/PATCH (orfile
if your payload is too big)body
key should only be used inresponse
, notrequest
json
key is invalid & not supported by stubby4jPlease refer to the stubby4j user manual for more information about the YAML config for
request
&response
: https://stubby4j.com/docs/http_endpoint_configuration_howto.html