How can I set the reason phrase on a HTTP response in ASP.NET Core from some middleware?
In previous versions (full framework), I would do the following:
context.Response.StatusCode = 401;
context.Response.ReasonPhrase = "Missing or invalid token.";
In ASP.NET Core, the only property available is the StatusCode
.
Here is an example of a Fiddler capture with a custom reason set on the response.