mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
Is it possible using post method with query parameters request matching? #261
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 @shockliang on GitHub (Mar 22, 2020).
I'm implementing create group for gitlab server [doc] and trying write tests to verify some cases.
Above simple code that doesn't work when using
WithParamas request matching .So... Any way to verify post with query parameters?
@StefH commented on GitHub (Mar 22, 2020):
This should be possible, see https://github.com/WireMock-Net/WireMock.Net/blob/master/examples/WireMock.Net.Console.Net452.Classic/MainApp.cs#L496
Result:

@shockliang commented on GitHub (Mar 22, 2020):
My environment:
OS: mac os 10.14.6
dotnet version: dotnet core 3.0.
I got the response with
Not Foundand content{"Status":"No matching mapping found"}@StefH commented on GitHub (Mar 22, 2020):
What you can do to debug, is set
AllowPartialMappingto true in the WireMockServerSettingshttps://github.com/WireMock-Net/WireMock.Net/wiki/Settings#allowpartialmapping
When you look at the logging from the running application, you can see which elements have a score from 1.0 (=100% match)

(I just added a netcore3.1 example to this repository, that one also does work fine.)
@shockliang commented on GitHub (Mar 22, 2020):
It's work after setting
AllowPartialMappingto be true.But the request matching doesn't work. The match details show me the score of
RequestMessageParamMatcherstill zero.Is it normally when setting
AllowPartialMappingto be true?@StefH commented on GitHub (Mar 22, 2020):
Can you please provide details on the complete request you send? Because from the logging it seems you provide multiple parameters?
@shockliang commented on GitHub (Mar 23, 2020):
Yes, the actual code I'm using 4 parameters. I'm sorry about that.
I'm using RestSharp as http client.
This is my actual code.
@StefH commented on GitHub (Mar 23, 2020):
When using 4 params (see updated code https://github.com/WireMock-Net/WireMock.Net/blob/master/examples/WireMock.Net.Console.Net452.Classic/MainApp.cs#L496)

And using postman, this works fine:
@shockliang commented on GitHub (Mar 24, 2020):
OK! I will keeping investigate my cases. Thank for your helping! 👍
@StefH commented on GitHub (Apr 1, 2020):
Closing this issue.
If you still have problems, just reply here or create a new issue.