This commit is contained in:
Stef Heyenrath
2026-02-28 16:02:22 +01:00
parent d472d158bd
commit 933c8ab0b8
10 changed files with 32 additions and 25 deletions
@@ -45,12 +45,12 @@ public class ProxyAndRecordSettingsModel
/// <summary>
/// Defines a list from headers which will be excluded from the saved mappings.
/// </summary>
public string[] ExcludedHeaders { get; set; }
public string[] ExcludedHeaders { get; set; } = [];
/// <summary>
/// Defines a list of cookies which will be excluded from the saved mappings.
/// </summary>
public string[] ExcludedCookies { get; set; }
public string[] ExcludedCookies { get; set; } = [];
/// <summary>
/// Prefer the Proxy Mapping over the saved Mapping (in case SaveMapping is set to <c>true</c>).
@@ -32,11 +32,6 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<None Remove="../../resources/WireMock.Net-Logo.png" />
<None Include="../../resources/WireMock.Net-LogoAspire.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
</ItemGroup>
@@ -19,7 +19,7 @@ internal class GlobalExceptionMiddleware
_responseMapper = Guard.NotNull(responseMapper);
}
public RequestDelegate? Next { get; }
public RequestDelegate Next { get; }
public Task Invoke(HttpContext ctx)
{
@@ -30,10 +30,7 @@ internal class GlobalExceptionMiddleware
{
try
{
if (Next != null)
{
await Next.Invoke(ctx).ConfigureAwait(false);
}
await Next.Invoke(ctx).ConfigureAwait(false);
}
catch (Exception ex)
{
@@ -1,7 +1,6 @@
// Copyright © WireMock.Net
using System.Diagnostics;
using System.Linq;
using System.Net;
using Microsoft.AspNetCore.Http;
using WireMock.Constants;
@@ -18,7 +17,9 @@ using WireMock.Util;
namespace WireMock.Owin;
internal class WireMockMiddleware(
#pragma warning disable CS9113 // Parameter is unread.
RequestDelegate next,
#pragma warning restore CS9113 // Parameter is unread.
IWireMockMiddlewareOptions options,
IOwinRequestMapper requestMapper,
IOwinResponseMapper responseMapper,
@@ -298,7 +298,7 @@ internal class OpenApiPathsMapper(WireMockOpenApiParserSettings settings)
var mappedHeaders = headers?
.ToDictionary(item => item.Key, _ => GetExampleMatcherModel(null, _settings.HeaderPatternToUse).Pattern!) ?? [];
if (!string.IsNullOrEmpty(responseContentType))
if (responseContentType != null)
{
mappedHeaders.TryAdd(HeaderContentType, responseContentType);
}
@@ -1,6 +1,5 @@
// Copyright © WireMock.Net
using System;
using WireMock.Models;
using WireMock.Util;
@@ -40,6 +39,6 @@ public class RequestMessageProtoBufMatcher : IRequestMatcher
private MatchResult GetMatchResult(IRequestMessage requestMessage)
{
return Matcher?.IsMatchAsync(requestMessage.BodyAsBytes).GetAwaiter().GetResult() ?? default;
return Matcher?.IsMatchAsync(requestMessage.BodyAsBytes).GetAwaiter().GetResult() ?? MatchResult.From(nameof(RequestMessageProtoBufMatcher));
}
}