C# 如何从Kestrel服务器设置StatusDescription?
如何从Kestrel服务器设置HTTP状态描述?我想回来 HTTP/1.1 400 ArgumentException代替HTTP/1.1 400错误请求,但在DefaultHttpResponse中找不到StatusDescription属性,我只能用数字代码更改StatusCode 以下是示例应用程序:C# 如何从Kestrel服务器设置StatusDescription?,c#,.net-core,kestrel-http-server,C#,.net Core,Kestrel Http Server,如何从Kestrel服务器设置HTTP状态描述?我想回来 HTTP/1.1 400 ArgumentException代替HTTP/1.1 400错误请求,但在DefaultHttpResponse中找不到StatusDescription属性,我只能用数字代码更改StatusCode 以下是示例应用程序: 您需要访问HTTP上下文功能来覆盖原因短语,例如: context.Response .HttpContext .Features .Get<IHttpResp
您需要访问HTTP上下文功能来覆盖原因短语,例如:
context.Response
.HttpContext
.Features
.Get<IHttpResponseFeature>()
.ReasonPhrase = "Stuff here";
您需要访问HTTP上下文功能来覆盖原因短语,例如:
context.Response
.HttpContext
.Features
.Get<IHttpResponseFeature>()
.ReasonPhrase = "Stuff here";