Refactor some code (IBodyDataExtensions)

This commit is contained in:
Stef Heyenrath
2024-09-20 13:52:45 +02:00
parent dd80fd7822
commit 2cbbef01ae
3 changed files with 30 additions and 24 deletions

View File

@@ -1,9 +1,12 @@
using WireMock.Types;
// Copyright © WireMock.Net
using WireMock.Types;
// ReSharper disable once CheckNamespace
namespace WireMock.Util;
public static class IBodyDataExtension
// ReSharper disable once InconsistentNaming
public static class IBodyDataExtensions
{
public static BodyType GetBodyType(this IBodyData bodyData)
{
@@ -11,10 +14,12 @@ public static class IBodyDataExtension
{
return bodyData.DetectedBodyTypeFromContentType.Value;
}
if (bodyData.DetectedBodyType is not null and not BodyType.None)
{
return bodyData.DetectedBodyType.Value;
}
return BodyType.None;
}
}