-
-
Notifications
You must be signed in to change notification settings - Fork 784
Expand file tree
/
Copy pathByteArrayPart.cs
More file actions
30 lines (26 loc) · 1.18 KB
/
Copy pathByteArrayPart.cs
File metadata and controls
30 lines (26 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) 2019-2026 ReactiveUI and Contributors. All rights reserved.
// ReactiveUI and Contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
using System.Net.Http;
namespace Refit;
/// <summary>Allows the use of a <see cref="byte"/> array in a multipart form body.</summary>
/// <param name="value">The value.</param>
/// <param name="fileName">Name of the file.</param>
/// <param name="contentType">Type of the content.</param>
/// <param name="name">The name.</param>
/// <exception cref="System.ArgumentNullException">value</exception>
/// <remarks>
/// Initializes a new instance of the <see cref="ByteArrayPart"/> class.
/// </remarks>
[System.Diagnostics.DebuggerDisplay("{Value}")]
public class ByteArrayPart(
byte[] value,
string fileName,
string? contentType = null,
string? name = null) : MultipartItem(fileName, contentType, name)
{
/// <summary>Gets the byte array value.</summary>
public byte[] Value { get; } = value ?? throw new ArgumentNullException(nameof(value));
/// <inheritdoc/>
protected override HttpContent CreateContent() => new ByteArrayContent(Value);
}