Share via


OpenApiRouteHandlerBuilderExtensions.Produces Method

Definition

Overloads

Produces(RouteHandlerBuilder, Int32, Type, String, String[])

Adds an IProducesResponseTypeMetadata to Metadata for all endpoints produced by builder.

Produces<TResponse>(RouteHandlerBuilder, Int32, String, String[])

Adds an IProducesResponseTypeMetadata to Metadata for all endpoints produced by builder.

Produces(RouteHandlerBuilder, Int32, Type, String, String[])

Source:
OpenApiRouteHandlerBuilderExtensions.cs

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

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[])

Source:
OpenApiRouteHandlerBuilderExtensions.cs

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

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