mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-16 07:06:54 +01:00
Allow configure IgnoreCase in settings (#695)
* Add IgnoreCase = true in Request body, query parameters, headers, example value * Ignorecase is configurable in settings! * Remove unnecesary comments!
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -115,6 +115,7 @@ namespace WireMock.Net.OpenApiParser.Mappers
|
||||
requestBodyModel.Matcher = new MatcherModel();
|
||||
requestBodyModel.Matcher.Name = "JsonMatcher";
|
||||
requestBodyModel.Matcher.Pattern = JsonConvert.SerializeObject(requestBody, Formatting.Indented);
|
||||
requestBodyModel.Matcher.IgnoreCase = _settings.IgnoreCaseRequestBody;
|
||||
return requestBodyModel;
|
||||
}
|
||||
|
||||
@@ -327,6 +328,7 @@ namespace WireMock.Net.OpenApiParser.Mappers
|
||||
.Select(qp => new ParamModel
|
||||
{
|
||||
Name = qp.Name,
|
||||
IgnoreCase = _settings.IgnoreCaseQueryParams,
|
||||
Matchers = new[]
|
||||
{
|
||||
GetExampleMatcherModel(qp.Schema, _settings.QueryParameterPatternToUse)
|
||||
@@ -344,6 +346,7 @@ namespace WireMock.Net.OpenApiParser.Mappers
|
||||
.Select(qp => new HeaderModel
|
||||
{
|
||||
Name = qp.Name,
|
||||
IgnoreCase = _settings.IgnoreCaseHeaders,
|
||||
Matchers = new[]
|
||||
{
|
||||
GetExampleMatcherModel(qp.Schema, _settings.HeaderPatternToUse)
|
||||
@@ -358,7 +361,7 @@ namespace WireMock.Net.OpenApiParser.Mappers
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
ExampleValueType.Value => new MatcherModel { Name = "ExactMatcher", Pattern = GetExampleValueAsStringForSchemaType(schema) },
|
||||
ExampleValueType.Value => new MatcherModel { Name = "ExactMatcher", Pattern = GetExampleValueAsStringForSchemaType(schema), IgnoreCase = _settings.IgnoreCaseExampleValues },
|
||||
|
||||
_ => new MatcherModel { Name = "WildcardMatcher", Pattern = "*" }
|
||||
};
|
||||
|
||||
@@ -36,5 +36,25 @@ namespace WireMock.Net.OpenApiParser.Settings
|
||||
/// Are examples generated dynamically?
|
||||
/// </summary>
|
||||
public bool DynamicExamples { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Is headers case sensitive? (default is true).
|
||||
/// </summary>
|
||||
public bool IgnoreCaseHeaders { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Is query params case sensitive? (default is true).
|
||||
/// </summary>
|
||||
public bool IgnoreCaseQueryParams { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Is request body case sensitive? (default is true).
|
||||
/// </summary>
|
||||
public bool IgnoreCaseRequestBody { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Are example values case sensitive? (default is true).
|
||||
/// </summary>
|
||||
public bool IgnoreCaseExampleValues { get; set; } = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user