mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
url param - how to accept either of multiple values #189
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @gregoks on GitHub (Jul 11, 2019).
Hi,
I'm trying to create mapping to accept both of the following GET requests:
http://localhost:5566/test?abc=123
http://localhost:5566/test?abc=456
I have tried several options but none of them accept them both:
requestMatcher.WithParam("abc" , "123", "456" );this option will only accept requests that look like this - http://localhost:5566/test?abc=123&abc=456
Setting mapping for one of the values will work but only for that one value, so this single mapping:
requestMatcher.WithParam("abc", MatchBehaviour.AcceptOnMatch, true, "123");will be able to accept request http://localhost:5566/test?abc=123
Can you please assist?
Thanks,
Greg
@StefH commented on GitHub (Jul 11, 2019):
Good question.
The best option would be to use a RegexMatcher (https://github.com/WireMock-Net/WireMock.Net/wiki/Request-Matching#regular-expression-matching).
This is supported !
Just use:
@gregoks commented on GitHub (Jul 12, 2019):
Thanks I will try!