mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
How can I correctly find or ignore the ? character from a request url in the RegexMatcher used via postman, not coded. #466
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 @lszlszl on GitHub (Nov 17, 2022).
Originally assigned to: @StefH on GitHub.
Latest stable wiremock version was downloaded and configured. I send messages to them via postman.
I configured a RegexMatcher, what is okay, if I do not send a ? in the url.
steps
"Pattern": "(\/some\/service\/v1\/name)([?]{1})(param.source=SYSTEM){1}([&]{1})(param.id=123457890){1}$"https://localhost/wiremock/some/service/v1/name?param.source=SYSTEM¶m.id=123457890
expected result:
answer arrives correctly with defined response message
actual result:
exception : "ClassName":"System.NullReferenceException","Message":"Object reference not set to an instance of an object.\
Please be specific so we can provide the best answer possible:
if I not use ? in the link and change it to other character (e.g. "a-z" "0-9" + & $ ), then the same expression will work correctly
I tried ([?]{1}), ([\?]{1}) (.*{1}) ((/u003F){1})
How can I define the part from de regexp correctly ([?]{1}) to find or ignore ?
@StefH commented on GitHub (Nov 17, 2022):
@lszlszl
Please provide the mappping json you send to wiremock.
@lszlszl commented on GitHub (Nov 17, 2022):
@StefH commented on GitHub (Nov 18, 2022):
What I would suggest is:
1️⃣
Use a RegexMatcher for only the path :
(\/some\/service\/v1\/name)2️⃣
Use a RegexMatcher/ExactMatcher or WildcardMatcher for the Query Parameters:
@lszlszl commented on GitHub (Nov 19, 2022):
@lszlszl commented on GitHub (Nov 19, 2022):
okay, thank you! That"s working fine.