Class RouteHandlerBuilderExtensions
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.dll
Syntax
public static class RouteHandlerBuilderExtensions
Methods
Accepts<TRequest>(RouteHandlerBuilder)
override the default "accepts metadata" in order to accept any content-type from the client.
Declaration
public static RouteHandlerBuilder Accepts<TRequest>(this RouteHandlerBuilder hb) where TRequest : notnull
Parameters
Type | Name | Description |
---|---|---|
RouteHandlerBuilder | hb |
Returns
Type | Description |
---|---|
RouteHandlerBuilder |
Type Parameters
Name | Description |
---|---|
TRequest | the type of the request dto |
ClearDefaultAccepts(RouteHandlerBuilder)
clears just the default "accepts metadata" from the endpoint.
Declaration
public static RouteHandlerBuilder ClearDefaultAccepts(this RouteHandlerBuilder hb)
Parameters
Type | Name | Description |
---|---|---|
RouteHandlerBuilder | hb |
Returns
Type | Description |
---|---|
RouteHandlerBuilder |
ClearDefaultProduces(RouteHandlerBuilder, params int[])
clears any number of given "produces metadata" from the endpoint by supplying the status codes of the responses to remove. not specifying any status codes will result in all produces metadata being removed.
Declaration
public static RouteHandlerBuilder ClearDefaultProduces(this RouteHandlerBuilder hb, params int[] statusCodes)
Parameters
Type | Name | Description |
---|---|---|
RouteHandlerBuilder | hb | |
int[] | statusCodes | one or more status codes of the defaults to remove |
Returns
Type | Description |
---|---|
RouteHandlerBuilder |
ProducesProblemDetails(RouteHandlerBuilder, int, string)
adds produces metadata of type ProblemDetails (RFC7807 compatible) to the endpoint description
Declaration
public static RouteHandlerBuilder ProducesProblemDetails(this RouteHandlerBuilder hb, int statusCode = 400, string contentType = "application/problem+json")
Parameters
Type | Name | Description |
---|---|---|
RouteHandlerBuilder | hb | |
int | statusCode | the status code of the error response |
string | contentType | content type header value |
Returns
Type | Description |
---|---|
RouteHandlerBuilder |
ProducesProblemFE(RouteHandlerBuilder, int, string)
adds produces metadata of type ErrorResponse to the endpoint description
Declaration
public static RouteHandlerBuilder ProducesProblemFE(this RouteHandlerBuilder hb, int statusCode = 400, string contentType = "application/problem+json")
Parameters
Type | Name | Description |
---|---|---|
RouteHandlerBuilder | hb | |
int | statusCode | the status code of the error response |
string | contentType | content type header value |
Returns
Type | Description |
---|---|
RouteHandlerBuilder |
ProducesProblemFE<TResponse>(RouteHandlerBuilder, int, string)
adds produces metadata for a given type of error response dto
Declaration
public static RouteHandlerBuilder ProducesProblemFE<TResponse>(this RouteHandlerBuilder hb, int statusCode = 400, string contentType = "application/problem+json")
Parameters
Type | Name | Description |
---|---|---|
RouteHandlerBuilder | hb | |
int | statusCode | the status code of the error response |
string | contentType | content type header value |
Returns
Type | Description |
---|---|
RouteHandlerBuilder |
Type Parameters
Name | Description |
---|---|
TResponse | the type of the error response |