-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Milestone
Description
The ContentHttpResult already supports setting a custom status code but the factory methods that allow creation of ContentHttpResult do not expose a status code parameter.
We should add the parameter to the existing Content factory methods on Results and TypedResults to allow setting a custom status code:
public static class Results
{
- public static IResult Content(string content, string? contentType = null, Encoding? contentEncoding = null);
+ public static IResult Content(string content, string? contentType, Encoding? contentEncoding);
+ public static IResult Content(string content, string? contentType = null, Encoding? contentEncoding = null, int? statusCode = null);
+ public static IResult Text(string? content, string? contentType, Encoding? contentEncoding)
+ public static IResult Text(string? content, string? contentType = null, Encoding? contentEncoding = null, int? statusCode = null);
}
public static class TypedResults
{
- public static ContentHttpResult Content(string? content, string? contentType = null, Encoding? contentEncoding = null)
+ public static ContentHttpResult Content(string content, string? contentType, Encoding? contentEncoding);
+ public static ContentHttpResult Content(string? content, string? contentType = null, Encoding? contentEncoding = null, int? statusCode = null)
- public static ContentHttpResult Text(string? content, string? contentType = null, Encoding? contentEncoding = null)
+ public static ContentHttpResult Text(string? content, string? contentType, Encoding? contentEncoding)
+ public static ContentHttpResult Text(string? content, string? contentType = null, Encoding? contentEncoding = null, int? statusCode = null);
}Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels