mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-24 09:18:27 +02:00
remove MimeKitLite and use MediaTypeHeaderValue (#338)
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VersionPrefix>1.0.29</VersionPrefix>
|
<VersionPrefix>1.0.30</VersionPrefix>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Choose>
|
<Choose>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
https://github.com/StefH/GitHubReleaseNotes
|
https://github.com/StefH/GitHubReleaseNotes
|
||||||
|
|
||||||
GitHubReleaseNotes.exe --output CHANGELOG.md --skip-empty-releases --exclude-labels question, invalid --version 1.0.29.0
|
GitHubReleaseNotes.exe --output CHANGELOG.md --skip-empty-releases --exclude-labels question, invalid --version 1.0.30.0
|
||||||
@@ -72,7 +72,7 @@ namespace WireMock.Http
|
|||||||
var httpResponseMessage = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead);
|
var httpResponseMessage = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead);
|
||||||
|
|
||||||
// Create ResponseMessage
|
// Create ResponseMessage
|
||||||
return await HttpResponseMessageHelper.Create(httpResponseMessage, requiredUri, originalUri);
|
return await HttpResponseMessageHelper.CreateAsync(httpResponseMessage, requiredUri, originalUri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using MimeKit;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using WireMock.Util;
|
using WireMock.Util;
|
||||||
using WireMock.Validation;
|
using WireMock.Validation;
|
||||||
@@ -19,11 +19,11 @@ namespace WireMock.Http
|
|||||||
|
|
||||||
var httpRequestMessage = new HttpRequestMessage(new HttpMethod(requestMessage.Method), url);
|
var httpRequestMessage = new HttpRequestMessage(new HttpMethod(requestMessage.Method), url);
|
||||||
|
|
||||||
ContentType contentType = null;
|
MediaTypeHeaderValue contentType = null;
|
||||||
if (requestMessage.Headers != null && requestMessage.Headers.ContainsKey(HttpKnownHeaderNames.ContentType))
|
if (requestMessage.Headers != null && requestMessage.Headers.ContainsKey(HttpKnownHeaderNames.ContentType))
|
||||||
{
|
{
|
||||||
var value = requestMessage.Headers[HttpKnownHeaderNames.ContentType].FirstOrDefault();
|
var value = requestMessage.Headers[HttpKnownHeaderNames.ContentType].FirstOrDefault();
|
||||||
ContentType.TryParse(value, out contentType);
|
MediaTypeHeaderValue.TryParse(value, out contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (requestMessage.BodyData?.DetectedBodyType)
|
switch (requestMessage.BodyData?.DetectedBodyType)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace WireMock.Http
|
|||||||
{
|
{
|
||||||
internal static class HttpResponseMessageHelper
|
internal static class HttpResponseMessageHelper
|
||||||
{
|
{
|
||||||
public static async Task<ResponseMessage> Create(HttpResponseMessage httpResponseMessage, Uri requiredUri, Uri originalUri)
|
public static async Task<ResponseMessage> CreateAsync(HttpResponseMessage httpResponseMessage, Uri requiredUri, Uri originalUri)
|
||||||
{
|
{
|
||||||
var responseMessage = new ResponseMessage { StatusCode = (int)httpResponseMessage.StatusCode };
|
var responseMessage = new ResponseMessage { StatusCode = (int)httpResponseMessage.StatusCode };
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Text;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using MimeKit;
|
|
||||||
using WireMock.Validation;
|
using WireMock.Validation;
|
||||||
|
|
||||||
namespace WireMock.Http
|
namespace WireMock.Http
|
||||||
@@ -10,29 +8,18 @@ namespace WireMock.Http
|
|||||||
internal static class StringContentHelper
|
internal static class StringContentHelper
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a StringContent object. Note that the Encoding is only set when it's also set on the original header.
|
/// Creates a StringContent object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="content">The string content (cannot be null)</param>
|
/// <param name="content">The string content (cannot be null)</param>
|
||||||
/// <param name="contentType">The ContentType (can be null)</param>
|
/// <param name="contentType">The ContentType (can be null)</param>
|
||||||
/// <returns>StringContent</returns>
|
/// <returns>StringContent</returns>
|
||||||
internal static StringContent Create([NotNull] string content, [CanBeNull] ContentType contentType)
|
internal static StringContent Create([NotNull] string content, [CanBeNull] MediaTypeHeaderValue contentType)
|
||||||
{
|
{
|
||||||
Check.NotNull(content, nameof(content));
|
Check.NotNull(content, nameof(content));
|
||||||
|
|
||||||
if (contentType == null)
|
var stringContent = new StringContent(content);
|
||||||
{
|
stringContent.Headers.ContentType = contentType;
|
||||||
return new StringContent(content);
|
return stringContent;
|
||||||
}
|
|
||||||
|
|
||||||
if (contentType.Charset == null)
|
|
||||||
{
|
|
||||||
var stringContent = new StringContent(content);
|
|
||||||
stringContent.Headers.ContentType = new MediaTypeHeaderValue(contentType.MimeType);
|
|
||||||
return stringContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
var encoding = Encoding.GetEncoding(contentType.Charset);
|
|
||||||
return new StringContent(content, encoding, contentType.MimeType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,32 @@
|
|||||||
using JetBrains.Annotations;
|
using System.Collections.Generic;
|
||||||
using MimeKit;
|
using System.IO;
|
||||||
using Newtonsoft.Json;
|
using System.Linq;
|
||||||
using System;
|
using System.Net.Http.Headers;
|
||||||
using System.Collections.Generic;
|
using System.Text;
|
||||||
using System.IO;
|
using System.Threading.Tasks;
|
||||||
using System.Linq;
|
using JetBrains.Annotations;
|
||||||
using System.Text;
|
using Newtonsoft.Json;
|
||||||
using System.Threading.Tasks;
|
using WireMock.Matchers;
|
||||||
using WireMock.Matchers;
|
using WireMock.Validation;
|
||||||
using WireMock.Validation;
|
|
||||||
|
namespace WireMock.Util
|
||||||
namespace WireMock.Util
|
{
|
||||||
{
|
internal static class BodyParser
|
||||||
internal static class BodyParser
|
{
|
||||||
{
|
private static readonly Encoding DefaultEncoding = Encoding.UTF8;
|
||||||
private static readonly Encoding DefaultEncoding = Encoding.UTF8;
|
private static readonly Encoding[] SupportedBodyAsStringEncodingForMultipart = { Encoding.UTF8, Encoding.ASCII };
|
||||||
private static readonly Encoding[] SupportedBodyAsStringEncodingForMultipart = { Encoding.UTF8, Encoding.ASCII };
|
|
||||||
|
/*
|
||||||
/*
|
HEAD - No defined body semantics.
|
||||||
HEAD - No defined body semantics.
|
GET - No defined body semantics.
|
||||||
GET - No defined body semantics.
|
PUT - Body supported.
|
||||||
PUT - Body supported.
|
POST - Body supported.
|
||||||
POST - Body supported.
|
DELETE - No defined body semantics.
|
||||||
DELETE - No defined body semantics.
|
TRACE - Body not supported.
|
||||||
TRACE - Body not supported.
|
OPTIONS - Body supported but no semantics on usage (maybe in the future).
|
||||||
OPTIONS - Body supported but no semantics on usage (maybe in the future).
|
CONNECT - No defined body semantics
|
||||||
CONNECT - No defined body semantics
|
PATCH - Body supported.
|
||||||
PATCH - Body supported.
|
*/
|
||||||
*/
|
|
||||||
private static readonly IDictionary<string, bool> BodyAllowedForMethods = new Dictionary<string, bool>
|
private static readonly IDictionary<string, bool> BodyAllowedForMethods = new Dictionary<string, bool>
|
||||||
{
|
{
|
||||||
{ "HEAD", false },
|
{ "HEAD", false },
|
||||||
@@ -39,134 +38,131 @@ namespace WireMock.Util
|
|||||||
{ "OPTIONS", true },
|
{ "OPTIONS", true },
|
||||||
{ "CONNECT", false },
|
{ "CONNECT", false },
|
||||||
{ "PATCH", true }
|
{ "PATCH", true }
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly IStringMatcher[] MultipartContentTypesMatchers = {
|
private static readonly IStringMatcher[] MultipartContentTypesMatchers = {
|
||||||
new WildcardMatcher("multipart/*", true)
|
new WildcardMatcher("multipart/*", true)
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly IStringMatcher[] JsonContentTypesMatchers = {
|
private static readonly IStringMatcher[] JsonContentTypesMatchers = {
|
||||||
new WildcardMatcher("application/json", true),
|
new WildcardMatcher("application/json", true),
|
||||||
new WildcardMatcher("application/vnd.*+json", true)
|
new WildcardMatcher("application/vnd.*+json", true)
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly IStringMatcher[] TextContentTypeMatchers =
|
private static readonly IStringMatcher[] TextContentTypeMatchers =
|
||||||
{
|
{
|
||||||
new WildcardMatcher("text/*", true),
|
new WildcardMatcher("text/*", true),
|
||||||
new RegexMatcher("^application\\/(java|type)script$", true),
|
new RegexMatcher("^application\\/(java|type)script$", true),
|
||||||
new WildcardMatcher("application/*xml", true),
|
new WildcardMatcher("application/*xml", true),
|
||||||
new WildcardMatcher("application/x-www-form-urlencoded", true)
|
new WildcardMatcher("application/x-www-form-urlencoded", true)
|
||||||
};
|
};
|
||||||
|
|
||||||
public static bool ParseBodyAsIsValid([CanBeNull] string parseBodyAs)
|
public static bool ShouldParseBody([CanBeNull] string method)
|
||||||
{
|
{
|
||||||
return Enum.TryParse(parseBodyAs, out BodyType _);
|
if (string.IsNullOrEmpty(method))
|
||||||
}
|
|
||||||
|
|
||||||
public static bool ShouldParseBody([CanBeNull] string method)
|
|
||||||
{
|
|
||||||
if (String.IsNullOrEmpty(method))
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (BodyAllowedForMethods.TryGetValue(method.ToUpper(), out var allowed))
|
|
||||||
|
if (BodyAllowedForMethods.TryGetValue(method.ToUpper(), out bool allowed))
|
||||||
{
|
{
|
||||||
return allowed;
|
return allowed;
|
||||||
}
|
}
|
||||||
// If we don't have any knowledge of this method, we should assume that a body *may*
|
|
||||||
// be present, so we should parse it if it is. Therefore, if a new method is added to
|
// If we don't have any knowledge of this method, we should assume that a body *may*
|
||||||
// the HTTP Method Registry, we only really need to add it to BodyAllowedForMethods if
|
// be present, so we should parse it if it is. Therefore, if a new method is added to
|
||||||
// we want to make it clear that a body is *not* allowed.
|
// the HTTP Method Registry, we only really need to add it to BodyAllowedForMethods if
|
||||||
return true;
|
// we want to make it clear that a body is *not* allowed.
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
public static BodyType DetectBodyTypeFromContentType([CanBeNull] string contentTypeValue)
|
|
||||||
{
|
public static BodyType DetectBodyTypeFromContentType([CanBeNull] string contentTypeValue)
|
||||||
if (string.IsNullOrEmpty(contentTypeValue) || !ContentType.TryParse(contentTypeValue, out ContentType contentType))
|
{
|
||||||
{
|
if (string.IsNullOrEmpty(contentTypeValue) || !MediaTypeHeaderValue.TryParse(contentTypeValue, out MediaTypeHeaderValue contentType))
|
||||||
return BodyType.Bytes;
|
{
|
||||||
}
|
return BodyType.Bytes;
|
||||||
|
}
|
||||||
if (TextContentTypeMatchers.Any(matcher => MatchScores.IsPerfect(matcher.IsMatch(contentType.MimeType))))
|
|
||||||
{
|
if (TextContentTypeMatchers.Any(matcher => MatchScores.IsPerfect(matcher.IsMatch(contentType.MediaType))))
|
||||||
return BodyType.String;
|
{
|
||||||
}
|
return BodyType.String;
|
||||||
|
}
|
||||||
if (JsonContentTypesMatchers.Any(matcher => MatchScores.IsPerfect(matcher.IsMatch(contentType.MimeType))))
|
|
||||||
{
|
if (JsonContentTypesMatchers.Any(matcher => MatchScores.IsPerfect(matcher.IsMatch(contentType.MediaType))))
|
||||||
return BodyType.Json;
|
{
|
||||||
}
|
return BodyType.Json;
|
||||||
|
}
|
||||||
if (MultipartContentTypesMatchers.Any(matcher => MatchScores.IsPerfect(matcher.IsMatch(contentType.MimeType))))
|
|
||||||
{
|
if (MultipartContentTypesMatchers.Any(matcher => MatchScores.IsPerfect(matcher.IsMatch(contentType.MediaType))))
|
||||||
return BodyType.MultiPart;
|
{
|
||||||
}
|
return BodyType.MultiPart;
|
||||||
|
}
|
||||||
return BodyType.Bytes;
|
|
||||||
}
|
return BodyType.Bytes;
|
||||||
|
}
|
||||||
public static async Task<BodyData> Parse([NotNull] Stream stream, [CanBeNull] string contentType)
|
|
||||||
{
|
public static async Task<BodyData> Parse([NotNull] Stream stream, [CanBeNull] string contentType)
|
||||||
Check.NotNull(stream, nameof(stream));
|
{
|
||||||
|
Check.NotNull(stream, nameof(stream));
|
||||||
var data = new BodyData
|
|
||||||
{
|
var data = new BodyData
|
||||||
BodyAsBytes = await ReadBytesAsync(stream),
|
{
|
||||||
DetectedBodyType = BodyType.Bytes,
|
BodyAsBytes = await ReadBytesAsync(stream),
|
||||||
DetectedBodyTypeFromContentType = DetectBodyTypeFromContentType(contentType)
|
DetectedBodyType = BodyType.Bytes,
|
||||||
};
|
DetectedBodyTypeFromContentType = DetectBodyTypeFromContentType(contentType)
|
||||||
|
};
|
||||||
// In case of MultiPart: check if the BodyAsBytes is a valid UTF8 or ASCII string, in that case read as String else keep as-is
|
|
||||||
if (data.DetectedBodyTypeFromContentType == BodyType.MultiPart)
|
// In case of MultiPart: check if the BodyAsBytes is a valid UTF8 or ASCII string, in that case read as String else keep as-is
|
||||||
{
|
if (data.DetectedBodyTypeFromContentType == BodyType.MultiPart)
|
||||||
if (BytesEncodingUtils.TryGetEncoding(data.BodyAsBytes, out Encoding encoding) &&
|
{
|
||||||
SupportedBodyAsStringEncodingForMultipart.Select(x => x.Equals(encoding)).Any())
|
if (BytesEncodingUtils.TryGetEncoding(data.BodyAsBytes, out Encoding encoding) &&
|
||||||
{
|
SupportedBodyAsStringEncodingForMultipart.Select(x => x.Equals(encoding)).Any())
|
||||||
data.BodyAsString = encoding.GetString(data.BodyAsBytes);
|
{
|
||||||
data.Encoding = encoding;
|
data.BodyAsString = encoding.GetString(data.BodyAsBytes);
|
||||||
data.DetectedBodyType = BodyType.String;
|
data.Encoding = encoding;
|
||||||
|
data.DetectedBodyType = BodyType.String;
|
||||||
return data;
|
|
||||||
}
|
return data;
|
||||||
|
}
|
||||||
return data;
|
|
||||||
}
|
return data;
|
||||||
|
}
|
||||||
// Try to get the body as String
|
|
||||||
try
|
// Try to get the body as String
|
||||||
{
|
try
|
||||||
data.BodyAsString = DefaultEncoding.GetString(data.BodyAsBytes);
|
{
|
||||||
data.Encoding = DefaultEncoding;
|
data.BodyAsString = DefaultEncoding.GetString(data.BodyAsBytes);
|
||||||
data.DetectedBodyType = BodyType.String;
|
data.Encoding = DefaultEncoding;
|
||||||
|
data.DetectedBodyType = BodyType.String;
|
||||||
// If string is not null or empty, try to get as Json
|
|
||||||
if (!string.IsNullOrEmpty(data.BodyAsString))
|
// If string is not null or empty, try to get as Json
|
||||||
{
|
if (!string.IsNullOrEmpty(data.BodyAsString))
|
||||||
try
|
{
|
||||||
{
|
try
|
||||||
data.BodyAsJson = JsonConvert.DeserializeObject(data.BodyAsString, new JsonSerializerSettings { Formatting = Formatting.Indented });
|
{
|
||||||
data.DetectedBodyType = BodyType.Json;
|
data.BodyAsJson = JsonConvert.DeserializeObject(data.BodyAsString, new JsonSerializerSettings { Formatting = Formatting.Indented });
|
||||||
}
|
data.DetectedBodyType = BodyType.Json;
|
||||||
catch
|
}
|
||||||
{
|
catch
|
||||||
// JsonConvert failed, just ignore.
|
{
|
||||||
}
|
// JsonConvert failed, just ignore.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
}
|
||||||
{
|
catch
|
||||||
// Reading as string failed, just ignore
|
{
|
||||||
}
|
// Reading as string failed, just ignore
|
||||||
|
}
|
||||||
return data;
|
|
||||||
}
|
return data;
|
||||||
private static async Task<byte[]> ReadBytesAsync(Stream stream)
|
}
|
||||||
{
|
private static async Task<byte[]> ReadBytesAsync(Stream stream)
|
||||||
using (var memoryStream = new MemoryStream())
|
{
|
||||||
{
|
using (var memoryStream = new MemoryStream())
|
||||||
await stream.CopyToAsync(memoryStream);
|
{
|
||||||
return memoryStream.ToArray();
|
await stream.CopyToAsync(memoryStream);
|
||||||
}
|
return memoryStream.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,6 @@
|
|||||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
<PackageReference Include="SimMetrics.Net" Version="1.0.5" />
|
<PackageReference Include="SimMetrics.Net" Version="1.0.5" />
|
||||||
<PackageReference Include="RestEase" Version="1.4.7" />
|
<PackageReference Include="RestEase" Version="1.4.7" />
|
||||||
<PackageReference Include="MimeKitLite" Version="2.0.7" />
|
|
||||||
<PackageReference Include="SonarAnalyzer.CSharp" Version="7.8.0.7320">
|
<PackageReference Include="SonarAnalyzer.CSharp" Version="7.8.0.7320">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ namespace WireMock.Net.Tests.Http
|
|||||||
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Check.That(message.Content.Headers.GetValues("Content-Type")).ContainsExactly("application/xml; charset=utf-8");
|
Check.That(message.Content.Headers.GetValues("Content-Type")).ContainsExactly("application/xml; charset=UTF-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -156,7 +156,7 @@ namespace WireMock.Net.Tests.Http
|
|||||||
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Check.That(message.Content.Headers.GetValues("Content-Type")).ContainsExactly("application/xml; charset=us-ascii");
|
Check.That(message.Content.Headers.GetValues("Content-Type")).ContainsExactly("application/xml; charset=Ascii");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
39
test/WireMock.Net.Tests/Http/StringContentHelperTests.cs
Normal file
39
test/WireMock.Net.Tests/Http/StringContentHelperTests.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Net.Http.Headers;
|
||||||
|
using FluentAssertions;
|
||||||
|
using WireMock.Http;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace WireMock.Net.Tests.Http
|
||||||
|
{
|
||||||
|
public class StringContentHelperTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void StringContentHelper_Create_WithNullContentType()
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
var result = StringContentHelper.Create("test", null);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
result.Headers.ContentType.Should().BeNull();
|
||||||
|
result.ReadAsStringAsync().Result.Should().Be("test");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("application/json", "application/json")]
|
||||||
|
[InlineData("application/soap+xml", "application/soap+xml")]
|
||||||
|
[InlineData("application/soap+xml;charset=UTF-8", "application/soap+xml; charset=UTF-8")]
|
||||||
|
[InlineData("application/soap+xml;charset=UTF-8;action=\"http://myCompany.Customer.Contract/ICustomerService/GetSomeConfiguration\"", "application/soap+xml; charset=UTF-8; action=\"http://myCompany.Customer.Contract/ICustomerService/GetSomeConfiguration\"")]
|
||||||
|
public void StringContentHelper_Create(string test, string expected)
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var contentType = MediaTypeHeaderValue.Parse(test);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = StringContentHelper.Create("test", contentType);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
result.Headers.ContentType.ToString().Should().Be(expected);
|
||||||
|
result.ReadAsStringAsync().Result.Should().Be("test");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,7 +39,6 @@
|
|||||||
<PackageReference Include="RestEase" Version="1.4.7" />
|
<PackageReference Include="RestEase" Version="1.4.7" />
|
||||||
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.8" />
|
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.8" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
|
||||||
<PackageReference Include="MimeKitLite" Version="2.0.7" />
|
|
||||||
<PackageReference Include="Moq" Version="4.10.1" />
|
<PackageReference Include="Moq" Version="4.10.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
<PackageReference Include="NFluent" Version="2.5.0" />
|
<PackageReference Include="NFluent" Version="2.5.0" />
|
||||||
|
|||||||
Reference in New Issue
Block a user