OpenApiRouteHandlerBuilderExtensions.ProducesProblem 方法

定义

IProducesResponseTypeMetadata为 生成builder的所有终结点将具有 ProblemDetails 类型的 添加到 Metadata

public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder ProducesProblem (this Microsoft.AspNetCore.Builder.RouteHandlerBuilder builder, int statusCode, string? contentType = default);
static member ProducesProblem : Microsoft.AspNetCore.Builder.RouteHandlerBuilder * int * string -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder
<Extension()>
Public Function ProducesProblem (builder As RouteHandlerBuilder, statusCode As Integer, Optional contentType As String = Nothing) As RouteHandlerBuilder

参数

statusCode
Int32

响应状态代码。

contentType
String

响应内容类型。 默认为“application/problem+json”。

返回

可用于 RouteHandlerBuilder 进一步自定义终结点的 。

适用于