23 types derived from HttpContent
dotnet-svcutil-lib (1)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageContent.cs (1)
17internal abstract class MessageContent : HttpContent
HttpStress (3)
Program.cs (3)
663private sealed class CancelableContent : HttpContent 690private sealed class StringDuplexContent : HttpContent 707private sealed class ByteAtATimeNoLengthContent : HttpContent
Interop.FunctionalTests (3)
Http3\Http3RequestTests.cs (1)
33private class StreamingHttpContent : HttpContent
HttpClientHttp2InteropTests.cs (2)
196private class BulkContent : HttpContent 451private class StreamingContent : HttpContent
Microsoft.AspNetCore.Http.Connections.Client (1)
Internal\SendUtils.cs (1)
91private sealed class ReadOnlySequenceContent : HttpContent
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (3)
Listener\RequestBodyTests.cs (1)
211private class StaggardContent : HttpContent
RequestBodyLimitTests.cs (1)
421private class StaggardContent : HttpContent
RequestBodyTests.cs (1)
355private class StaggardContent : HttpContent
Microsoft.AspNetCore.TestHost.Tests (2)
ClientHandlerTests.cs (1)
729private class UnlimitedContent : HttpContent
TestClientTests.cs (1)
551private class PushContent : HttpContent
Microsoft.Build.Tasks.UnitTests (1)
DownloadFile_Tests.cs (1)
365private sealed class MockHttpContent : HttpContent
System.Net.Http (8)
System\Net\Http\ByteArrayContent.cs (1)
11public class ByteArrayContent : HttpContent
System\Net\Http\EmptyContent.cs (1)
11internal sealed class EmptyContent : HttpContent
System\Net\Http\MultipartContent.cs (2)
15public class MultipartContent : HttpContent, IEnumerable<HttpContent>
System\Net\Http\ReadOnlyMemoryContent.cs (1)
10public sealed class ReadOnlyMemoryContent : HttpContent
System\Net\Http\SocketsHttpHandler\DecompressionHandler.cs (1)
108private abstract class DecompressedContent : HttpContent
System\Net\Http\SocketsHttpHandler\HttpConnectionResponseContent.cs (1)
11internal sealed class HttpConnectionResponseContent : HttpContent
System\Net\Http\StreamContent.cs (1)
13public class StreamContent : HttpContent
System.Net.Http.Json (1)
System\Net\Http\Json\JsonContent.cs (1)
16public sealed partial class JsonContent : HttpContent
136 references to HttpContent
Aspire.EndToEnd.Tests (1)
tests\Shared\WorkloadTesting\AspireProject.cs (1)
483if (args.Outcome.Result?.Content is HttpContent content && (await content.ReadAsStringAsync()) is string contentStr)
Aspire.Workload.Tests (1)
tests\Shared\WorkloadTesting\AspireProject.cs (1)
483if (args.Outcome.Result?.Content is HttpContent content && (await content.ReadAsStringAsync()) is string contentStr)
Binding.Http.IntegrationTests (1)
BasicHttpBindingTests.4.0.0.cs (1)
162var oldContent = message.Content;
ConfigurationSchemaGenerator.Tests (1)
GeneratorTests.cs (1)
49MetadataReference.CreateFromFile(typeof(HttpContent).Assembly.Location)
dotnet-svcutil-lib (10)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpRequestMessageProperty.cs (3)
321HttpContent content = this.HttpRequestMessage.Content; 338HttpContent content = this.HttpRequestMessage.Content; 343HttpContent newContent = new ByteArrayContent(Array.Empty<byte>());
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpResponseMessageHelper.cs (3)
129var content = _httpResponseMessage.Content; 168var content = _httpResponseMessage.Content; 291var content = _httpResponseMessage.Content;
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpResponseMessageProperty.cs (3)
345HttpContent content = this.HttpResponseMessage.Content; 362HttpContent content = this.HttpResponseMessage.Content; 367HttpContent newContent = new ByteArrayContent(Array.Empty<byte>());
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageContent.cs (1)
154internal static HttpContent Create(HttpChannelFactory<IRequestChannel> factory, Message request, TimeoutHelper _timeoutHelper)
InMemory.FunctionalTests (2)
TestTransport\InMemoryHttpClientSlim.cs (2)
68public async Task<string> PostAsync(string requestUri, HttpContent content, bool validateCertificate = true) 71public async Task<string> PostAsync(Uri requestUri, HttpContent content, bool validateCertificate = true)
Interop.FunctionalTests (1)
HttpClientHttp2InteropTests.cs (1)
1696private static HttpRequestMessage CreateRequestMessage(HttpMethod method, string url, HttpContent content)
Microsoft.AspNetCore.HeaderPropagation.Tests (1)
HeaderPropagationMessageHandlerTest.cs (1)
262public HttpContent Content { get; private set; }
Microsoft.AspNetCore.Http.Extensions.Tests (12)
RequestDelegateFactoryTests.cs (2)
2048public static TheoryData<HttpContent, string> FormContent 2052var dataset = new TheoryData<HttpContent, string>();
RequestDelegateGenerator\RequestDelegateCreationTests.Forms.cs (10)
513public static TheoryData<HttpContent, string> FormContent 517var dataset = new TheoryData<HttpContent, string>(); 533public async Task RequestDelegatePopulatesFromIFormCollectionParameter(HttpContent content, string contentType) 580public async Task RequestDelegatePopulatesFromIFormCollectionParameterWithAttribute(HttpContent content, string contentType) 627public async Task RequestDelegatePopulatesFromOptionalFormParameter(HttpContent content, string contentType) 655public async Task RequestDelegatePopulatesFromMultipleRequiredFormParameters(HttpContent content, string contentType) 688public async Task RequestDelegatePopulatesFromOptionalMissingFormParameter(HttpContent content, string contentType) 719public async Task RequestDelegatePopulatesFromFormParameterWithMetadata(HttpContent content, string contentType) 748public async Task RequestDelegatePopulatesFromFormAndBoundParameter(HttpContent content, string contentType) 858public async Task RequestDelegateSets400ResponseIfRequiredFormItemNotSpecified(HttpContent content, string contentType)
Microsoft.AspNetCore.InternalTesting (2)
HttpClientSlim.cs (2)
68public static async Task<string> PostAsync(string requestUri, HttpContent content, bool validateCertificate = true) 72public static async Task<string> PostAsync(Uri requestUri, HttpContent content, bool validateCertificate = true)
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
TempDataInCookiesUsingCookieConsentTest.cs (1)
99private HttpRequestMessage GetPostRequest(string path, HttpContent content, HttpResponseMessage response)
Microsoft.AspNetCore.Mvc.Testing (7)
Handlers\RedirectHandler.cs (7)
49var originalRequestContent = HasBody(request) ? await DuplicateRequestContent(request) : null; 66private static async Task<HttpContent?> DuplicateRequestContent(HttpRequestMessage request) 72var originalRequestContent = request.Content; 84HttpContent originalRequestContent, 85HttpContent newRequestContent, 86HttpContent contentCopy) 135HttpContent? originalContent)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (3)
Listener\RequestBodyTests.cs (1)
200private async Task<string> SendRequestAsync(string uri, HttpContent content)
RequestBodyLimitTests.cs (1)
410private async Task<string> SendRequestAsync(string uri, HttpContent content, bool chunked = false)
RequestBodyTests.cs (1)
299private async Task<string> SendRequestAsync(string uri, HttpContent content)
Microsoft.AspNetCore.SignalR.Client.Tests (1)
ResponseUtils.cs (1)
26public static HttpResponseMessage CreateResponse(HttpStatusCode statusCode, HttpContent payload)
Microsoft.AspNetCore.TestHost (1)
ClientHandler.cs (1)
82var requestContent = request.Content;
Microsoft.Extensions.Http.Resilience (1)
Internal\RequestMessageSnapshot.cs (1)
23private HttpContent? _content;
Microsoft.ML.PerformanceTests (1)
ImageClassificationBench.cs (1)
230public static async Task ReadAsFileAsync(this HttpContent content, string filename, bool overwrite)
netstandard (1)
netstandard.cs (1)
1126[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Http.HttpContent))]
ServerComparison.FunctionalTests (1)
ResponseCompressionTests.cs (1)
224private static async Task<string> ReadCompressedAsStringAsync(HttpContent content)
System.Net.Http (67)
System\Net\Http\Headers\HttpContentHeaders.cs (2)
10private readonly HttpContent _parent; 109internal HttpContentHeaders(HttpContent parent)
System\Net\Http\HttpClient.cs (30)
65/// e.g.: <see cref="GetAsync(string?)" />, <see cref="PostAsync(string?, HttpContent)" />. 121if (value > HttpContent.MaxBufferSize) 125SR.net_http_content_buffersize_limit, HttpContent.MaxBufferSize)); 129Debug.Assert(HttpContent.MaxBufferSize <= int.MaxValue); 149_maxResponseContentBufferSize = HttpContent.MaxBufferSize; 193HttpContent c = response.Content; 203using var buffer = new HttpContent.LimitArrayPoolWriteStream(_maxResponseContentBufferSize, (int)c.Headers.ContentLength.GetValueOrDefault()); 209catch (Exception e) when (HttpContent.StreamCopyExceptionNeedsWrapping(e)) 211throw HttpContent.WrapStreamCopyException(e); 217return HttpContent.ReadBufferAsString(buffer.GetBuffer(), c.Headers); 268HttpContent c = response.Content; 284new HttpContent.LimitMemoryStream(_maxResponseContentBufferSize, (int)contentLength.GetValueOrDefault()) : 285new HttpContent.LimitArrayPoolWriteStream(_maxResponseContentBufferSize); 292catch (Exception e) when (HttpContent.StreamCopyExceptionNeedsWrapping(e)) 294throw HttpContent.WrapStreamCopyException(e); 299buffer is HttpContent.LimitMemoryStream lms ? lms.GetSizedBuffer() : 300((HttpContent.LimitArrayPoolWriteStream)buffer).ToArray(); 345HttpContent c = response.Content; 387public Task<HttpResponseMessage> PostAsync([StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, HttpContent? content) => 390public Task<HttpResponseMessage> PostAsync(Uri? requestUri, HttpContent? content) => 393public Task<HttpResponseMessage> PostAsync([StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, HttpContent? content, CancellationToken cancellationToken) => 396public Task<HttpResponseMessage> PostAsync(Uri? requestUri, HttpContent? content, CancellationToken cancellationToken) 403public Task<HttpResponseMessage> PutAsync([StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, HttpContent? content) => 406public Task<HttpResponseMessage> PutAsync(Uri? requestUri, HttpContent? content) => 409public Task<HttpResponseMessage> PutAsync([StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, HttpContent? content, CancellationToken cancellationToken) => 412public Task<HttpResponseMessage> PutAsync(Uri? requestUri, HttpContent? content, CancellationToken cancellationToken) 419public Task<HttpResponseMessage> PatchAsync([StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, HttpContent? content) => 422public Task<HttpResponseMessage> PatchAsync(Uri? requestUri, HttpContent? content) => 425public Task<HttpResponseMessage> PatchAsync([StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, HttpContent? content, CancellationToken cancellationToken) => 428public Task<HttpResponseMessage> PatchAsync(Uri? requestUri, HttpContent? content, CancellationToken cancellationToken)
System\Net\Http\HttpClientHandler.cs (2)
241if (value > HttpContent.MaxBufferSize) 245HttpContent.MaxBufferSize));
System\Net\Http\HttpContent.cs (4)
338throw new NotSupportedException(SR.Format(SR.net_http_missing_sync_implementation, GetType(), nameof(HttpContent), nameof(SerializeToStream))); 439CancellationTokenRegistration cancellationRegistration = cancellationToken.Register(static s => ((HttpContent)s!).Dispose(), this); 630if (maxBufferSize > HttpContent.MaxBufferSize) 636SR.net_http_content_buffersize_limit, HttpContent.MaxBufferSize));
System\Net\Http\HttpProtocolException.cs (2)
15/// When calling <see cref="Stream"/> methods on the stream returned by <see cref="HttpContent.ReadAsStream()"/> or 16/// <see cref="HttpContent.ReadAsStreamAsync(Threading.CancellationToken)"/>, <see cref="HttpProtocolException"/> can be thrown directly.
System\Net\Http\HttpRequestMessage.cs (2)
32private HttpContent? _content; 61public HttpContent? Content
System\Net\Http\HttpResponseMessage.cs (2)
22private HttpContent? _content; 42public HttpContent Content
System\Net\Http\MultipartContent.cs (12)
29private readonly List<HttpContent> _nestedContent; 61_nestedContent = new List<HttpContent>(); 96public virtual void Add(HttpContent content) 111foreach (HttpContent content in _nestedContent) 124public IEnumerator<HttpContent> GetEnumerator() 146public HeaderEncodingSelector<HttpContent>? HeaderEncodingSelector { get; set; } 168HttpContent content = _nestedContent[contentIndex]; 213HttpContent content = _nestedContent[contentIndex]; 264HttpContent nestedContent = _nestedContent[contentIndex]; 306private void SerializeHeadersToStream(Stream stream, HttpContent content, bool writeDivider) 348private MemoryStream EncodeHeadersToNewStream(HttpContent content, bool writeDivider) 369foreach (HttpContent content in _nestedContent)
System\Net\Http\MultipartFormDataContent.cs (4)
26public override void Add(HttpContent content) 35public void Add(HttpContent content, string name) 43public void Add(HttpContent content, string name, string fileName) 52private void AddInternal(HttpContent content, string name, string? fileName)
System\Net\Http\SocketsHttpHandler\DecompressionHandler.cs (5)
110private readonly HttpContent _originalContent; 113public DecompressedContent(HttpContent originalContent) 211public GZipDecompressedContent(HttpContent originalContent) 221public DeflateDecompressedContent(HttpContent originalContent) 427public BrotliDecompressedContent(HttpContent originalContent) :
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (1)
408private async Task SendContentAsync(HttpContent content, CancellationToken cancellationToken)
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (1)
381if (request.Content is HttpContent content)
System.Net.Http.Json (18)
System\Net\Http\Json\HttpContentJsonExtensions.AsyncEnumerable.cs (5)
31this HttpContent content, 51this HttpContent content, 76this HttpContent content, 91HttpContent content, 100HttpContent content,
System\Net\Http\Json\HttpContentJsonExtensions.cs (11)
30public static Task<object?> ReadFromJsonAsync(this HttpContent content, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default) 49public static Task<object?> ReadFromJsonAsync(this HttpContent content, Type type, CancellationToken cancellationToken = default) 64public static Task<T?> ReadFromJsonAsync<T>(this HttpContent content, JsonSerializerOptions? options, CancellationToken cancellationToken = default) 83public static Task<T?> ReadFromJsonAsync<T>(this HttpContent content, CancellationToken cancellationToken = default) 90private static async Task<object?> ReadFromJsonAsyncCore(HttpContent content, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken) 100private static async Task<T?> ReadFromJsonAsyncCore<T>(HttpContent content, JsonSerializerOptions? options, CancellationToken cancellationToken) 108public static Task<object?> ReadFromJsonAsync(this HttpContent content, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default) 118public static Task<T?> ReadFromJsonAsync<T>(this HttpContent content, JsonTypeInfo<T> jsonTypeInfo, CancellationToken cancellationToken = default) 128private static async Task<object?> ReadFromJsonAsyncCore(HttpContent content, Type type, JsonSerializerContext context, CancellationToken cancellationToken) 136private static async Task<T?> ReadFromJsonAsyncCore<T>(HttpContent content, JsonTypeInfo<T> jsonTypeInfo, CancellationToken cancellationToken) 144internal static ValueTask<Stream> GetContentStreamAsync(HttpContent content, CancellationToken cancellationToken)
System\Net\Http\Json\HttpContentJsonExtensions.netcoreapp.cs (1)
13private static Task<Stream> ReadHttpContentStreamAsync(HttpContent content, CancellationToken cancellationToken)
System\Net\Http\Json\JsonHelpers.cs (1)
30internal static Encoding? GetEncoding(HttpContent content)
System.Net.Requests (2)
System\Net\HttpWebRequest.cs (1)
1168private Task<HttpResponseMessage> SendRequest(bool async, HttpContent? content = null)
System\Net\RequestStreamContent.cs (1)
12internal sealed class RequestStreamContent(TaskCompletionSource<Stream> getStreamTcs, TaskCompletionSource completeTcs) : HttpContent