mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
Case insensitive and ignoring optional path and header parameters in OpenApiPathsMapper #387
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 @JanuszRybinski on GitHub (Nov 22, 2021).
Hello @StefH and @leolplex,
related to (#691) but I decided to start a new discussion. While I testing OpenApi Parser, I encountered an interesting behavior of HttpRequestMessage, I will show on an example.
Assuming I have this definition of request:
And I want to define a request for this:
I did not check why exactly, but a header called "X-Correlation-ID" will be added to the request. By this small difference there is no matching mapping. In my opinion, headers should not be case-sensitive. To be sure, I checked what is in the RFC (https://www.rfc-editor.org/rfc/rfc7230#section-3.2). I have another idea to set case ignore in MapRequestHeaders:
It seems to me that a similar setting also could be used in MapQueryParameters.
Additionally, I think that only the required parameters and headers should be taken into mappings:
What is your opinion? If you agree, should I submit a new PR, or it can be added as part of #691?
Regards,
Janusz
@leolplex commented on GitHub (Nov 23, 2021):
Hello @JanuszRybinski / @StefH ,
It all makes sense to me, I also would add the required parameters in request body.
8865543bf1/src/WireMock.Net.OpenApiParser/Mappers/OpenApiPathsMapper.cs (L64)if (operation.RequestBody != null && operation.RequestBody.Content != null && operation.RequestBody.Required)@StefH commented on GitHub (Nov 23, 2021):
You can create a new PR.