mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-28 19:27:05 +02:00
Fix WithBody when using Pact and added more nullable annotations (#783)
* More nullable annotations * . * . * FIX * pact * . * p * xxx * ... * auth * array * ...
This commit is contained in:
@@ -5,7 +5,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -30,9 +29,9 @@ namespace WireMock.Owin
|
||||
|
||||
public bool IsStarted { get; private set; }
|
||||
|
||||
public List<string> Urls { get; } = new List<string>();
|
||||
public List<string> Urls { get; } = new();
|
||||
|
||||
public List<int> Ports { get; } = new List<int>();
|
||||
public List<int> Ports { get; } = new();
|
||||
|
||||
public Exception RunningException => _runningException;
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@ namespace WireMock.Owin.Mappers
|
||||
{
|
||||
bytes = bytes.Take(bytes.Length / 2).Union(_randomizerBytes.Generate()).ToArray();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -80,11 +79,10 @@ namespace WireMock.Owin.Mappers
|
||||
}
|
||||
|
||||
var statusCodeType = responseMessage.StatusCode?.GetType();
|
||||
|
||||
switch (statusCodeType)
|
||||
{
|
||||
case Type typeAsIntOrEnum when typeAsIntOrEnum == typeof(int) || typeAsIntOrEnum == typeof(int?) || typeAsIntOrEnum.GetTypeInfo().IsEnum:
|
||||
response.StatusCode = MapStatusCode((int)responseMessage.StatusCode);
|
||||
response.StatusCode = MapStatusCode((int)responseMessage.StatusCode!);
|
||||
break;
|
||||
|
||||
case Type typeAsString when typeAsString == typeof(string):
|
||||
@@ -138,7 +136,7 @@ namespace WireMock.Owin.Mappers
|
||||
return responseMessage.BodyData.BodyAsBytes;
|
||||
|
||||
case BodyType.File:
|
||||
return _options.FileSystemHandler.ReadResponseBodyAsFile(responseMessage.BodyData.BodyAsFile);
|
||||
return _options.FileSystemHandler?.ReadResponseBodyAsFile(responseMessage.BodyData.BodyAsFile);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user