mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-14 06:17:11 +01:00
Create WireMock.Net.MimePart project (#1300)
* Create WireMock.Net.MimePart project * . * REFACTOR * ILRepack * -- * ... * x * x * . * fix * public class MimePartMatcher * shared * min * . * <!--<DelaySign>true</DelaySign>--> * Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
27
src/WireMock.Net.Minimal/Http/ByteArrayContentHelper.cs
Normal file
27
src/WireMock.Net.Minimal/Http/ByteArrayContentHelper.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace WireMock.Http;
|
||||
|
||||
internal static class ByteArrayContentHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a ByteArrayContent object.
|
||||
/// </summary>
|
||||
/// <param name="content">The byte[] content (cannot be null)</param>
|
||||
/// <param name="contentType">The ContentType (can be null)</param>
|
||||
/// <returns>ByteArrayContent</returns>
|
||||
internal static ByteArrayContent Create(byte[] content, MediaTypeHeaderValue? contentType)
|
||||
{
|
||||
var byteContent = new ByteArrayContent(content);
|
||||
if (contentType != null)
|
||||
{
|
||||
byteContent.Headers.Remove(HttpKnownHeaderNames.ContentType);
|
||||
byteContent.Headers.ContentType = contentType;
|
||||
}
|
||||
|
||||
return byteContent;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user