Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

OpenApiRouteHandlerBuilderExtensions.Accepts 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

Accepts(RouteHandlerBuilder, Type, String, String[])

Source:
OpenApiRouteHandlerBuilderExtensions.cs

Adds IAcceptsMetadata to Metadata for all endpoints produced by builder.

public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder Accepts(this Microsoft.AspNetCore.Builder.RouteHandlerBuilder builder, Type requestType, string contentType, params string[] additionalContentTypes);
static member Accepts : Microsoft.AspNetCore.Builder.RouteHandlerBuilder * Type * string * string[] -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder
<Extension()>
Public Function Accepts (builder As RouteHandlerBuilder, requestType As Type, contentType As String, ParamArray additionalContentTypes As String()) As RouteHandlerBuilder

Parameters

requestType
Type

The type of the request body.

contentType
String

The request content type that the endpoint accepts.

additionalContentTypes
String[]

The list of additional request content types that the endpoint accepts.

Returns

A RouteHandlerBuilder that can be used to further customize the endpoint.

Applies to

Accepts(RouteHandlerBuilder, Type, Boolean, String, String[])

Source:
OpenApiRouteHandlerBuilderExtensions.cs

Adds IAcceptsMetadata to Metadata for all endpoints produced by builder.

public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder Accepts(this Microsoft.AspNetCore.Builder.RouteHandlerBuilder builder, Type requestType, bool isOptional, string contentType, params string[] additionalContentTypes);
static member Accepts : Microsoft.AspNetCore.Builder.RouteHandlerBuilder * Type * bool * string * string[] -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder
<Extension()>
Public Function Accepts (builder As RouteHandlerBuilder, requestType As Type, isOptional As Boolean, contentType As String, ParamArray additionalContentTypes As String()) As RouteHandlerBuilder

Parameters

requestType
Type

The type of the request body.

isOptional
Boolean

Sets a value that determines if the request body is optional.

contentType
String

The request content type that the endpoint accepts.

additionalContentTypes
String[]

The list of additional request content types that the endpoint accepts.

Returns

A RouteHandlerBuilder that can be used to further customize the endpoint.

Applies to

Accepts<TRequest>(RouteHandlerBuilder, String, String[])

Source:
OpenApiRouteHandlerBuilderExtensions.cs

Adds IAcceptsMetadata to Metadata for all endpoints produced by builder.

public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder Accepts<TRequest>(this Microsoft.AspNetCore.Builder.RouteHandlerBuilder builder, string contentType, params string[] additionalContentTypes);
static member Accepts : Microsoft.AspNetCore.Builder.RouteHandlerBuilder * string * string[] -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder
<Extension()>
Public Function Accepts(Of TRequest) (builder As RouteHandlerBuilder, contentType As String, ParamArray additionalContentTypes As String()) As RouteHandlerBuilder

Type Parameters

TRequest

The type of the request body.

Parameters

contentType
String

The request content type that the endpoint accepts.

additionalContentTypes
String[]

The list of additional request content types that the endpoint accepts.

Returns

A RouteHandlerBuilder that can be used to further customize the endpoint.

Applies to

Accepts<TRequest>(RouteHandlerBuilder, Boolean, String, String[])

Source:
OpenApiRouteHandlerBuilderExtensions.cs

Adds IAcceptsMetadata to Metadata for all endpoints produced by builder.

public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder Accepts<TRequest>(this Microsoft.AspNetCore.Builder.RouteHandlerBuilder builder, bool isOptional, string contentType, params string[] additionalContentTypes);
static member Accepts : Microsoft.AspNetCore.Builder.RouteHandlerBuilder * bool * string * string[] -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder
<Extension()>
Public Function Accepts(Of TRequest) (builder As RouteHandlerBuilder, isOptional As Boolean, contentType As String, ParamArray additionalContentTypes As String()) As RouteHandlerBuilder

Type Parameters

TRequest

The type of the request body.

Parameters

isOptional
Boolean

Sets a value that determines if the request body is optional.

contentType
String

The request content type that the endpoint accepts.

additionalContentTypes
String[]

The list of additional request content types that the endpoint accepts.

Returns

A RouteHandlerBuilder that can be used to further customize the endpoint.

Applies to


Feedback

Was this page helpful?