mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
Error in RequestMessageMultiPartMatcher #608
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 @rmeshksar on GitHub (Jun 14, 2024).
Originally assigned to: @StefH on GitHub.
Hi,
I would like to match multipart requests.
In the request there can be several parts and I only need to match some of them and not all.
It seems when passing an array of matchers to .WithMultipart it has to be one to one associated with the request but in my case there can be different number of parts in the request and I always want to only match the first two parts based on some conditions.
In the example below request has 3 parts but how can I check if the part that has text/json content-type has specific content regardless of other parts or regardless of position of the json part.
I commented out some elements of matchers array and it fails.
@rmeshksar commented on GitHub (Jun 14, 2024):
I think it is a bug.
in the file ~\Matchers\Request\RequestMessageMultiPartMatcher.cs, the logic of GetMatchingScore method should be changed to have two loops with the outer loop to be matchers and inner loop each part.
I tried the following and it worked but there might be better ways to implement it:
@StefH commented on GitHub (Jun 29, 2024):
@rmeshksar
Can you please create a fix PR which also includes a unit-test?
@rmeshksar commented on GitHub (Jul 4, 2024):
I will do it in this week. Thanks