54 instantiations of ConsumesAttribute
BasicWebSite (13)
Controllers\ActionConstraints\ConsumesAttribute_MediaTypeSuffix.cs (2)
12[Consumes("application/vnd.example+json")] 21[Consumes("application/vnd.example+xml")]
Controllers\ActionConstraints\ConsumesAttribute_NoFallBackActionController.cs (2)
12[Consumes("application/json", "text/json")] 18[Consumes("application/xml")]
Controllers\ActionConstraints\ConsumesAttribute_OveridesBaseController.cs (2)
9[Consumes("application/json")] 12[Consumes("text/json")]
Controllers\ActionConstraints\ConsumesAttribute_OveridesController.cs (1)
9[Consumes("application/xml")]
Controllers\ActionConstraints\ConsumesAttribute_PassThroughController.cs (3)
12[Consumes("application/json")] 18[Consumes("application/json")] 24[Consumes("application/xml")]
Controllers\ActionConstraints\ConsumesAttribute_WithFallbackActionController.cs (2)
11[Consumes("application/json")] 18[Consumes("application/xml")]
Controllers\FiltersController.cs (1)
13[Consumes("application/yaml")]
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (8)
DefaultApiDescriptionProviderTest.cs (1)
1444new FilterDescriptor(new ConsumesAttribute("multipart/form-data"), FilterScope.Action),
EndpointMetadataApiDescriptionProviderTest.cs (7)
73[Consumes("application/custom")] 78[Consumes("application/custom")] 87[Consumes("application/custom0", "application/custom1")] 106[Consumes(typeof(InferredJsonClass), "application/custom0", "application/custom1", IsOptional = true)] 121[Consumes(typeof(InferredJsonClass), "application/custom0", "application/custom1", IsOptional = false)] 1155builder.MapPost("/api/todos", [Consumes("application/xml")] (InferredJsonClass? inferredJsonClass) => ""); 1273[Consumes("application/custom0", "application/custom1")] (IFormFile file) => Results.NoContent());
Microsoft.AspNetCore.Mvc.Core (1)
ApplicationModels\ConsumesConstraintForFormFileParameterConvention.cs (1)
54action.Filters.Add(new ConsumesAttribute("multipart/form-data"));
Microsoft.AspNetCore.Mvc.Core.Test (21)
ApplicationModels\ConsumesConstraintForFormFileParameterConventionTest.cs (1)
91[Consumes("application/json")]
ApplicationModels\EndpointMetadataProviderTest.cs (3)
150builder => builder.Metadata.Add(new ConsumesAttribute("application/json")), 171builder => builder.Metadata.Add(new ConsumesAttribute("application/json")), 192builder => builder.Metadata.Add(new ConsumesAttribute("application/json")),
ApplicationModels\InferParameterBindingInfoConventionTest.cs (1)
992[Consumes("application/json")]
ConsumesAttributeTests.cs (16)
28var exception = Assert.Throws<FormatException>(() => new ConsumesAttribute(contentType)); 46() => new ConsumesAttribute(contentTypes[0], contentTypes.Skip(1).ToArray())); 66() => new ConsumesAttribute(contentTypes[0], contentTypes.Skip(1).ToArray())); 84var constraint = new ConsumesAttribute("application/json", "text/xml"); 108var constraint1 = new ConsumesAttribute("application/json", "text/xml"); 146var constraint1 = new ConsumesAttribute("application/json", "text/xml"); 183var constraint1 = new ConsumesAttribute("application/json"); 190var constraint2 = new ConsumesAttribute("text/xml"); 224var constraint1 = new ConsumesAttribute("application/json"); 231var constraint2 = new ConsumesAttribute("text/xml"); 262var constraint1 = new ConsumesAttribute("application/json"); 269var constraint2 = new ConsumesAttribute("text/xml"); 302var consumesFilter = new ConsumesAttribute("application/json"); 332var consumesFilter = new ConsumesAttribute("application/json"); 361var consumesFilter = new ConsumesAttribute("application/json", "application/xml"); 385var attribute = new ConsumesAttribute("application/json", "text/json");
Microsoft.AspNetCore.Mvc.Test (1)
Routing\ActionConstraintMatcherPolicyTest.cs (1)
392new ConsumesAttribute("text/json"),
Microsoft.AspNetCore.OpenApi.Tests (9)
Services\OpenApiDocumentService\OpenApiDocumentServiceTests.RequestBody.cs (2)
240builder.MapPost("/", [Consumes(typeof(IFormFile), "application/magic-foo-content-type")] (IFormFile formFile) => { }); 363builder.MapPost("/", [Consumes(typeof(string), "application/magic-foo-content-type")] (string name) => { });
Services\OpenApiGeneratorTests.cs (7)
92[Consumes("application/custom")] (InferredJsonClass fromBody) => { })); 95[Consumes("application/custom")] ([FromBody] int fromBody) => { })); 102[Consumes("application/custom0", "application/custom1")] (InferredJsonClass fromBody) => { }); 115[Consumes(typeof(InferredJsonClass), "application/custom0", "application/custom1", IsOptional = true)] () => { }); 132[Consumes(typeof(InferredJsonClass), "application/custom0", "application/custom1", IsOptional = false)] (InferredJsonClass fromBody) => { }); 730var operation = GetOpenApiOperation([Consumes("application/xml")] (InferredJsonClass? inferredJsonClass) => ""); 786[Consumes("application/custom0", "application/custom1")] (IFormFile file) => Results.NoContent());
Mvc.RoutingWebSite (1)
Controllers\ConsumesAttributeController.cs (1)
12[Consumes("application/json")]
22 references to ConsumesAttribute
Microsoft.AspNetCore.Mvc.Core (5)
ApplicationModels\ConsumesConstraintForFormFileParameterConvention.cs (1)
11/// An <see cref="IActionModelConvention"/> that adds a <see cref="ConsumesAttribute"/> with <c>multipart/form-data</c>
ConsumesAttribute.cs (2)
35/// Creates a new instance of <see cref="ConsumesAttribute"/>. 57/// Creates a new instance of <see cref="ConsumesAttribute"/>.
Routing\ActionConstraintMatcherPolicy.cs (1)
62else if (actionConstraint.GetType() == typeof(ConsumesAttribute))
Routing\ActionEndpointFactory.cs (1)
423else if (actionConstraint is ConsumesAttribute consumesAttribute &&
Microsoft.AspNetCore.Mvc.Core.Test (17)
ApplicationModels\ConsumesConstraintForFormFileParameterConventionTest.cs (4)
26var consumesAttribute = Assert.IsType<ConsumesAttribute>(attribute); 47var consumesAttribute = Assert.IsType<ConsumesAttribute>(attribute);
ConsumesAttributeTests.cs (13)
84var constraint = new ConsumesAttribute("application/json", "text/xml"); 108var constraint1 = new ConsumesAttribute("application/json", "text/xml"); 146var constraint1 = new ConsumesAttribute("application/json", "text/xml"); 183var constraint1 = new ConsumesAttribute("application/json"); 190var constraint2 = new ConsumesAttribute("text/xml"); 224var constraint1 = new ConsumesAttribute("application/json"); 231var constraint2 = new ConsumesAttribute("text/xml"); 262var constraint1 = new ConsumesAttribute("application/json"); 269var constraint2 = new ConsumesAttribute("text/xml"); 302var consumesFilter = new ConsumesAttribute("application/json"); 332var consumesFilter = new ConsumesAttribute("application/json"); 361var consumesFilter = new ConsumesAttribute("application/json", "application/xml"); 385var attribute = new ConsumesAttribute("application/json", "text/json");