44 instantiations of MediaType
Microsoft.AspNetCore.Mvc.Core (23)
ConsumesAttribute.cs (3)
130var parsedRequestMediaType = new MediaType(requestMediaType); 133var contentTypeMediaType = new MediaType(ContentTypes[i]); 244var mediaType = new MediaType(arg);
Formatters\FormatFilter.cs (2)
110var parsedContentType = new MediaType(contentType); 113var supportedMediaType = new MediaType(supportedMediaTypes[i]);
Formatters\InputFormatter.cs (4)
68var parsedContentType = new MediaType(contentType); 71var supportedMediaType = new MediaType(SupportedMediaTypes[i]); 144var parsedContentType = new MediaType(contentType); 151var parsedMediaType = new MediaType(mediaType);
Formatters\MediaType.cs (2)
207var parsedMediaType = new MediaType(mediaType); 249var parsedMediaType = new MediaType(mediaType);
Formatters\OutputFormatter.cs (4)
52var parsedContentType = contentType != null ? new MediaType(contentType) : default(MediaType); 56var parsedMediaType = new MediaType(mediaType); 120var parsedContentType = new MediaType(context.ContentType); 123var supportedMediaType = new MediaType(SupportedMediaTypes[i]);
Formatters\TextInputFormatter.cs (1)
85var requestMediaType = string.IsNullOrEmpty(requestContentType) ? default : new MediaType(requestContentType);
Formatters\TextOutputFormatter.cs (1)
83var parsedContentType = new MediaType(context.ContentType);
Infrastructure\DefaultOutputFormatterSelector.cs (4)
155var mediaType = new MediaType(result[i].MediaType); 243var acceptableContentType = new MediaType(sortedAcceptableContentTypes[i].MediaType); 246var candidateContentType = new MediaType(possibleOutputContentTypes[j]); 272var parsedContentType = new MediaType(contentType);
ProducesAttribute.cs (1)
112var contentType = new MediaType(arg);
ProducesResponseTypeAttribute.cs (1)
111var mediaType = new MediaType(type);
Microsoft.AspNetCore.Mvc.Core.Test (21)
Formatters\MediaTypeTest.cs (21)
18var result = new MediaType(mediaType, 0, mediaType.Length); 49var result = new MediaType(mediaType); 82var result = new MediaType(mediaType, 0, mediaType.Length); 98var result = new MediaType("mediaType", 1, length: null); 108Assert.Throws<ArgumentNullException>("mediaType", () => new MediaType(null, 0, 2)); 117Assert.Throws<ArgumentOutOfRangeException>("offset", () => new MediaType("media", offset, 5)); 124Assert.Throws<ArgumentOutOfRangeException>("length", () => new MediaType("media", 0, -1)); 131Assert.Throws<ArgumentException>(() => new MediaType("lengthof9", 5, 5)); 158var parsedMediaType = new MediaType(mediaType, 0, mediaType.Length); 172var parsedMediaType = new MediaType(mediaType, 0, mediaType.Length); 188var parsedMediaType = new MediaType(mediaType); 219var setMediaType = new MediaType(set); 220var subSetMediaType = new MediaType(subset); 248var setMediaType = new MediaType(set); 249var subSetMediaType = new MediaType(subset); 262var mediaType = new MediaType("*/*"); 277var mediaType = new MediaType(value); 292var mediaType = new MediaType(value); 305var mediaType = new MediaType("text/plain"); 325var mediaType = new MediaType(value); 347var mediaType = new MediaType(value);
84 references to MediaType
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
Internal\JsonRequestHelpers.cs (1)
92response.ContentType = MediaType.ReplaceEncoding("application/json", encoding);
Internal\JsonTranscodingServerCallContext.cs (1)
239HttpContext.Response.ContentType = contentType ?? MediaType.ReplaceEncoding("application/json", RequestEncoding);
Microsoft.AspNetCore.Mvc.Core (47)
ConsumesAttribute.cs (3)
130var parsedRequestMediaType = new MediaType(requestMediaType); 133var contentTypeMediaType = new MediaType(ContentTypes[i]); 244var mediaType = new MediaType(arg);
Formatters\AcceptHeaderParser.cs (1)
155result = MediaType.CreateMediaTypeSegmentWithQuality(input, start);
Formatters\FormatFilter.cs (2)
110var parsedContentType = new MediaType(contentType); 113var supportedMediaType = new MediaType(supportedMediaTypes[i]);
Formatters\InputFormatter.cs (4)
68var parsedContentType = new MediaType(contentType); 71var supportedMediaType = new MediaType(SupportedMediaTypes[i]); 144var parsedContentType = new MediaType(contentType); 151var parsedMediaType = new MediaType(mediaType);
Formatters\MediaType.cs (20)
23/// Initializes a <see cref="MediaType"/> instance. 32/// Initializes a <see cref="MediaType"/> instance. 72/// Gets the type of the <see cref="MediaType"/>. 80/// Gets whether this <see cref="MediaType"/> matches all types. 85/// Gets the subtype of the <see cref="MediaType"/>. 94/// Gets the subtype of the <see cref="MediaType"/>, excluding any structured syntax suffix. 103/// Gets the structured syntax suffix of the <see cref="MediaType"/> if it has one. 112/// Gets whether this <see cref="MediaType"/> matches all subtypes. 123/// Gets whether this <see cref="MediaType"/> matches all subtypes, ignoring any structured syntax suffix. 134/// Gets the <see cref="System.Text.Encoding"/> of the <see cref="MediaType"/> if it has one. 139/// Gets the charset parameter of the <see cref="MediaType"/> if it has one. 144/// Determines whether the current <see cref="MediaType"/> contains a wildcard. 147/// <c>true</c> if this <see cref="MediaType"/> contains a wildcard; otherwise <c>false</c>. 152/// Determines whether the current <see cref="MediaType"/> is a subset of the <paramref name="set"/> 153/// <see cref="MediaType"/>. 155/// <param name="set">The set <see cref="MediaType"/>.</param> 157/// <c>true</c> if this <see cref="MediaType"/> is a subset of <paramref name="set"/>; otherwise <c>false</c>. 159public bool IsSubsetOf(MediaType set) 207var parsedMediaType = new MediaType(mediaType); 249var parsedMediaType = new MediaType(mediaType);
Formatters\OutputFormatter.cs (5)
52var parsedContentType = contentType != null ? new MediaType(contentType) : default(MediaType); 56var parsedMediaType = new MediaType(mediaType); 120var parsedContentType = new MediaType(context.ContentType); 123var supportedMediaType = new MediaType(SupportedMediaTypes[i]);
Formatters\TextInputFormatter.cs (1)
85var requestMediaType = string.IsNullOrEmpty(requestContentType) ? default : new MediaType(requestContentType);
Formatters\TextOutputFormatter.cs (3)
44cache.Add(mediaType, MediaType.ReplaceEncoding(mediaType, Encoding.UTF8)); 83var parsedContentType = new MediaType(context.ContentType); 189return MediaType.ReplaceEncoding(mediaType, encoding);
Infrastructure\ContentResultExecutor.cs (1)
45MediaType.GetEncoding,
Infrastructure\DefaultOutputFormatterSelector.cs (4)
155var mediaType = new MediaType(result[i].MediaType); 243var acceptableContentType = new MediaType(sortedAcceptableContentTypes[i].MediaType); 246var candidateContentType = new MediaType(possibleOutputContentTypes[j]); 272var parsedContentType = new MediaType(contentType);
Infrastructure\SystemTextJsonResultExecutor.cs (1)
47MediaType.GetEncoding,
ProducesAttribute.cs (1)
112var contentType = new MediaType(arg);
ProducesResponseTypeAttribute.cs (1)
111var mediaType = new MediaType(type);
Microsoft.AspNetCore.Mvc.Core.Test (24)
ControllerBaseTest.cs (3)
2206Assert.Null(MediaType.GetEncoding(actualContentResult.ContentType)); 2222Assert.Same(Encoding.UTF8, MediaType.GetEncoding(actualContentResult.ContentType)); 2254Assert.Null(MediaType.GetEncoding(contentResult.ContentType));
Formatters\MediaTypeTest.cs (19)
18var result = new MediaType(mediaType, 0, mediaType.Length); 49var result = new MediaType(mediaType); 82var result = new MediaType(mediaType, 0, mediaType.Length); 98var result = new MediaType("mediaType", 1, length: null); 143var result = MediaType.ReplaceEncoding(mediaType, encoding); 158var parsedMediaType = new MediaType(mediaType, 0, mediaType.Length); 172var parsedMediaType = new MediaType(mediaType, 0, mediaType.Length); 188var parsedMediaType = new MediaType(mediaType); 219var setMediaType = new MediaType(set); 220var subSetMediaType = new MediaType(subset); 248var setMediaType = new MediaType(set); 249var subSetMediaType = new MediaType(subset); 262var mediaType = new MediaType("*/*"); 277var mediaType = new MediaType(value); 292var mediaType = new MediaType(value); 305var mediaType = new MediaType("text/plain"); 325var mediaType = new MediaType(value); 347var mediaType = new MediaType(value); 363var mediaTypeSegment = MediaType.CreateMediaTypeSegmentWithQuality(value, start: 0);
Formatters\ResponseContentTypeHelperTest.cs (2)
112MediaType.GetEncoding, 132MediaType.GetEncoding,
Microsoft.AspNetCore.Mvc.NewtonsoftJson (1)
NewtonsoftJsonResultExecutor.cs (1)
81MediaType.GetEncoding,
Microsoft.AspNetCore.Mvc.RazorPages.Test (6)
PageModelTest.cs (3)
1591Assert.Null(MediaType.GetEncoding(actualContentResult.ContentType)); 1607Assert.Same(Encoding.UTF8, MediaType.GetEncoding(actualContentResult.ContentType)); 1639Assert.Null(MediaType.GetEncoding(contentResult.ContentType));
PageTest.cs (3)
1581Assert.Null(MediaType.GetEncoding(actualContentResult.ContentType)); 1597Assert.Same(Encoding.UTF8, MediaType.GetEncoding(actualContentResult.ContentType)); 1629Assert.Null(MediaType.GetEncoding(contentResult.ContentType));
Microsoft.AspNetCore.Mvc.ViewFeatures (2)
ViewComponentResultExecutor.cs (1)
90MediaType.GetEncoding,
ViewExecutor.cs (1)
193MediaType.GetEncoding,
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (2)
ControllerUnitTestabilityTests.cs (1)
78Assert.Equal(encoding, MediaType.GetEncoding(contentResult.ContentType));
PartialViewResultExecutorTest.cs (1)
306Assert.Null(MediaType.GetEncoding(contentType));