mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-17 17:07:25 +01:00
* 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>
27 lines
808 B
C#
27 lines
808 B
C#
// 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;
|
|
}
|
|
} |