1 type derived from MediaTypeHeaderValue
System.Net.Http (1)
System\Net\Http\Headers\MediaTypeWithQualityHeaderValue.cs (1)
9public sealed class MediaTypeWithQualityHeaderValue : MediaTypeHeaderValue, ICloneable
15 instantiations of MediaTypeHeaderValue
Interop.FunctionalTests (1)
Http3\Http3RequestTests.cs (1)
372requestContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("text/plain");
Microsoft.AspNetCore.HttpLogging.Tests (2)
HttpLoggingMiddlewareTests.cs (2)
1777request.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("text/plain"); 1867request.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("text/plain");
Microsoft.AspNetCore.Mvc.FunctionalTests (2)
SimpleWithWebApplicationBuilderTests.cs (2)
234request.Content.Headers.ContentType = new("application/xml"); 249request.Content.Headers.ContentType = new("application/xml");
Microsoft.Extensions.Http.Diagnostics.PerformanceTests (2)
NoRemoteCallHandler.cs (1)
44response.Content.Headers.ContentType = new("application/json");
NoRemoteCallNotSeekableHandler.cs (1)
47response.Content.Headers.ContentType = new("application/json");
Microsoft.Extensions.Http.Diagnostics.Tests (3)
Logging\HttpHeadersReaderTest.cs (2)
132requestContent.Headers.ContentType = new(MediaTypeNames.Application.Soap); 141responseContent.Headers.ContentType = new(MediaTypeNames.Text.Html);
Logging\Internal\NoRemoteCallHandler.cs (1)
38response.Content.Headers.ContentType = new("application/json");
System.Net.Http (5)
System\Net\Http\FormUrlEncodedContent.cs (1)
23Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
System\Net\Http\Headers\MediaTypeHeaderParser.cs (1)
32private static MediaTypeHeaderValue CreateMediaType() => new MediaTypeHeaderValue();
System\Net\Http\Headers\MediaTypeHeaderValue.cs (1)
291return new MediaTypeHeaderValue(this);
System\Net\Http\MultipartContent.cs (1)
57MediaTypeHeaderValue contentType = new MediaTypeHeaderValue("multipart/" + subtype);
System\Net\Http\StringContent.cs (1)
73Headers.ContentType = new MediaTypeHeaderValue(mediaType, encoding.WebName);
129 references to MediaTypeHeaderValue
Aspire.Dashboard (2)
Otlp\Http\OtlpHttpEndpointsBuilder.cs (2)
78if (contentType != null && MediaTypeHeaderValue.TryParse(contentType, out var mt))
dotnet-svcutil-lib (7)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpResponseMessageHelper.cs (1)
132var mediaValueContentType = content.Headers.ContentType;
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageContent.cs (2)
129MediaTypeHeaderValue contentTypeHeaderValue; 130if (MediaTypeHeaderValue.TryParse(contentType, out contentTypeHeaderValue))
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageEncoder.cs (2)
201MediaTypeHeaderValue parsedContentType = MediaTypeHeaderValue.Parse(contentType);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\TextMessageEncoder.cs (2)
215MediaTypeHeaderValue parsedContentType = MediaTypeHeaderValue.Parse(contentType);
Microsoft.AspNetCore.Authentication.OpenIdConnect (2)
OpenIdConnectHandler.cs (2)
611var contentType = parResponseMessage.Content.Headers.ContentType; 1065var contentType = responseMessage.Content.Headers.ContentType;
Microsoft.AspNetCore.Mvc.FunctionalTests (77)
BasicTests.cs (8)
45var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); 65var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); 88var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); 109var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8");
ContentNegotiationTest.cs (35)
42var expectedContentType = MediaTypeHeaderValue.Parse("application/custom;charset=utf-8"); 58var expectedContentType = MediaTypeHeaderValue.Parse("application/json;charset=utf-8"); 75var expectedContentType = MediaTypeHeaderValue.Parse("text/plain;charset=utf-8"); 91var expectedContentType = MediaTypeHeaderValue.Parse("application/json;charset=utf-8"); 108var expectedContentType = MediaTypeHeaderValue.Parse("application/json;charset=utf-8"); 124var expectedContentType = MediaTypeHeaderValue.Parse("application/json;charset=utf-8"); 147var expectedContentType = MediaTypeHeaderValue.Parse("application/xml;charset=utf-8"); 172var expectedContentType = MediaTypeHeaderValue.Parse("application/json;charset=utf-8"); 221var contentType = response.Content.Headers.ContentType; 234var expectedContentType = MediaTypeHeaderValue.Parse( 251var expectedContentType = MediaTypeHeaderValue.Parse( 269var expectedContentType = MediaTypeHeaderValue.Parse( 286var expectedContentType = MediaTypeHeaderValue.Parse( 303var expectedContentType = MediaTypeHeaderValue.Parse( 321var expectedContentType = MediaTypeHeaderValue.Parse("application/json;charset=utf-8"); 339var expectedContentType = MediaTypeHeaderValue.Parse("application/xml;charset=utf-8"); 488var expectedMediaType = MediaTypeHeaderValue.Parse("application/vnd.example.contact+json; v=2; charset=utf-8"); 506var expectedMediaType = MediaTypeHeaderValue.Parse("application/vnd.example.contact+xml; v=2; charset=utf-8");
ErrorPageTests.cs (10)
60var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); 95var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); 116var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); 136var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); 154var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8");
HtmlGenerationTest.cs (10)
102var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); 131var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); 219var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); 259var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); 299var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8");
LinkGenerationTests.cs (2)
76var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8");
OutputFormatterTest.cs (4)
39var expectedContentType = MediaTypeHeaderValue.Parse("text/plain;charset=utf-8"); 57var expectedContentType = MediaTypeHeaderValue.Parse("application/json;charset=utf-8");
RazorPagesTest.cs (2)
46var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8");
TagHelpersTest.cs (6)
51var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); 88var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); 109var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8");
Microsoft.Extensions.Http.Diagnostics (2)
Logging\Internal\HttpRequestBodyReader.cs (1)
54var contentType = request.Content.Headers.ContentType;
Logging\Internal\HttpResponseBodyReader.cs (1)
46var contentType = response.Content.Headers.ContentType;
netstandard (1)
netstandard.cs (1)
1108[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Http.Headers.MediaTypeHeaderValue))]
System.Net.Http (33)
System\Net\Http\Headers\HttpContentHeaders.cs (2)
91public MediaTypeHeaderValue? ContentType 93get { return (MediaTypeHeaderValue?)GetSingleParsedValue(KnownHeaders.ContentType.Descriptor); }
System\Net\Http\Headers\MediaTypeHeaderParser.cs (5)
10private readonly Func<MediaTypeHeaderValue> _mediaTypeCreator; 16private MediaTypeHeaderParser(bool supportsMultipleValues, Func<MediaTypeHeaderValue> mediaTypeCreator) 26int resultLength = MediaTypeHeaderValue.GetMediaTypeLength(value, startIndex, _mediaTypeCreator, out MediaTypeHeaderValue? temp); 32private static MediaTypeHeaderValue CreateMediaType() => new MediaTypeHeaderValue();
System\Net\Http\Headers\MediaTypeHeaderValue.cs (23)
14/// The <see cref="MediaTypeHeaderValue"/> class provides support for the media type used in a Content-Type header 81/// <summary>Initializes a new instance of the <see cref="MediaTypeHeaderValue"/> class.</summary> 82/// <param name="source">A <see cref="MediaTypeHeaderValue"/> object used to initialize the new instance.</param> 83protected MediaTypeHeaderValue(MediaTypeHeaderValue source) 91/// <summary>Initializes a new instance of the <see cref="MediaTypeHeaderValue"/> class.</summary> 98/// <summary>Initializes a new instance of the <see cref="MediaTypeHeaderValue"/> class.</summary> 112/// <summary>Returns a string that represents the current <see cref="MediaTypeHeaderValue"/> object.</summary> 127/// <summary>Determines whether the specified <see cref="object"/> is equal to the current <see cref="MediaTypeHeaderValue"/> object.</summary> 131obj is MediaTypeHeaderValue other && 135/// <summary>Serves as a hash function for an <see cref="MediaTypeHeaderValue"/> object.</summary> 147/// <summary>Converts a string to an <see cref="MediaTypeHeaderValue"/> instance.</summary> 149/// <returns>A <see cref="MediaTypeHeaderValue"/> instance.</returns> 152public static MediaTypeHeaderValue Parse(string input) 155return (MediaTypeHeaderValue)MediaTypeHeaderParser.SingleValueParser.ParseValue(input, null, ref index); 158/// <summary>Determines whether a string is valid <see cref="MediaTypeHeaderValue"/> information.</summary> 160/// <param name="parsedValue">The <see cref="MediaTypeHeaderValue"/> version of the string.</param> 161/// <returns><see langword="true"/> if input is valid <see cref="MediaTypeHeaderValue"/> information; otherwise, <see langword="false"/>.</returns> 162public static bool TryParse([NotNullWhen(true)] string? input, [NotNullWhen(true)] out MediaTypeHeaderValue? parsedValue) 169parsedValue = (MediaTypeHeaderValue)output!; 176Func<MediaTypeHeaderValue> mediaTypeCreator, out MediaTypeHeaderValue? parsedValue) 189int mediaTypeLength = MediaTypeHeaderValue.GetMediaTypeExpressionLength(input, startIndex, out string? mediaType); 198MediaTypeHeaderValue mediaTypeHeader;
System\Net\Http\MultipartContent.cs (1)
57MediaTypeHeaderValue contentType = new MediaTypeHeaderValue("multipart/" + subtype);
System\Net\Http\StringContent.cs (2)
30public StringContent(string content, MediaTypeHeaderValue? mediaType) 80public StringContent(string content, Encoding? encoding, MediaTypeHeaderValue? mediaType)
System.Net.Http.Json (5)
System\Net\Http\Json\JsonContent.cs (5)
25MediaTypeHeaderValue? mediaType) 53public static JsonContent Create<T>(T inputValue, MediaTypeHeaderValue? mediaType = null, JsonSerializerOptions? options = null) 66public static JsonContent Create(object? inputValue, Type inputType, MediaTypeHeaderValue? mediaType = null, JsonSerializerOptions? options = null) 82public static JsonContent Create<T>(T? inputValue, JsonTypeInfo<T> jsonTypeInfo, MediaTypeHeaderValue? mediaType = null) 96public static JsonContent Create(object? inputValue, JsonTypeInfo jsonTypeInfo, MediaTypeHeaderValue? mediaType = null)