WireMock.Net
WireMock.Net copied to clipboard
Matching for x-www-form-urlencoded request body
Hi!
I need to mock POST request with x-www-form-urlencoded
body: param1=value1¶m2=value2¶m3=value3¶m4=value4
. I've been reading wiki pages regarding request matching but haven't found any option for matching URL encoded body. Is it possible to achieve with WireMock.Net
. If yes, how can I implement it?
Thanks in advance!
@KyryloAntoshyn Did you just try this:
For the body:
"Body": {
"Matcher": {
"Name": "ExactMatcher",
"Pattern": "param1=value1¶m2=value2¶m3=value3¶m4=value4"
}
}
And for the header:
"Headers": [
{
"Name": "Content-Type",
"Matchers": [
{
"Name": "WildcardMatcher",
"Pattern": "x-www-form-urlencoded",
"IgnoreCase": true
}
]
}
]
Thanks, it works fine for me!