Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
OpenApiRouteHandlerBuilderExtensions.Produces Method
Definition
- Namespace:
- Microsoft.AspNetCore.Http
- Assembly:
- Microsoft.AspNetCore.Routing.dll
- Package:
- Microsoft.AspNetCore.App.Ref v10.0.0
- Package:
- Microsoft.AspNetCore.App.Ref v11.0.0-preview.4.26230.115
- Package:
- Microsoft.AspNetCore.App.Ref v6.0.36
- Package:
- Microsoft.AspNetCore.App.Ref v7.0.5
- Package:
- Microsoft.AspNetCore.App.Ref v8.0.19
- Package:
- Microsoft.AspNetCore.App.Ref v9.0.8
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| Produces(RouteHandlerBuilder, Int32, Type, String, String[]) |
Adds an IProducesResponseTypeMetadata to Metadata for all endpoints
produced by |
| Produces<TResponse>(RouteHandlerBuilder, Int32, String, String[]) |
Adds an IProducesResponseTypeMetadata to Metadata for all endpoints
produced by |
Produces(RouteHandlerBuilder, Int32, Type, String, String[])
Adds an IProducesResponseTypeMetadata to Metadata for all endpoints
produced by builder.
public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder Produces(this Microsoft.AspNetCore.Builder.RouteHandlerBuilder builder, int statusCode, Type? responseType = default, string? contentType = default, params string[] additionalContentTypes);
static member Produces : Microsoft.AspNetCore.Builder.RouteHandlerBuilder * int * Type * string * string[] -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder
<Extension()>
Public Function Produces (builder As RouteHandlerBuilder, statusCode As Integer, Optional responseType As Type = Nothing, Optional contentType As String = Nothing, ParamArray additionalContentTypes As String()) As RouteHandlerBuilder
Parameters
- builder
- RouteHandlerBuilder
The RouteHandlerBuilder.
- statusCode
- Int32
The response status code.
- responseType
- Type
The type of the response. Defaults to null.
- contentType
- String
The response content type. Defaults to "application/json" if responseType is not null, otherwise defaults to null.
- additionalContentTypes
- String[]
Additional response content types the endpoint produces for the supplied status code.
Returns
A RouteHandlerBuilder that can be used to further customize the endpoint.
Applies to
Produces<TResponse>(RouteHandlerBuilder, Int32, String, String[])
Adds an IProducesResponseTypeMetadata to Metadata for all endpoints
produced by builder.
public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder Produces<TResponse>(this Microsoft.AspNetCore.Builder.RouteHandlerBuilder builder, int statusCode = 200, string? contentType = default, params string[] additionalContentTypes);
static member Produces : Microsoft.AspNetCore.Builder.RouteHandlerBuilder * int * string * string[] -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder
<Extension()>
Public Function Produces(Of TResponse) (builder As RouteHandlerBuilder, Optional statusCode As Integer = 200, Optional contentType As String = Nothing, ParamArray additionalContentTypes As String()) As RouteHandlerBuilder
Type Parameters
- TResponse
The type of the response.
Parameters
- builder
- RouteHandlerBuilder
The RouteHandlerBuilder.
- statusCode
- Int32
The response status code. Defaults to Status200OK.
- contentType
- String
The response content type. Defaults to "application/json".
- additionalContentTypes
- String[]
Additional response content types the endpoint produces for the supplied status code.
Returns
A RouteHandlerBuilder that can be used to further customize the endpoint.
Applies to
Feedback
Was this page helpful?
