OpenApiRouteHandlerBuilderExtensions.Produces Method
Definition
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
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.