-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make IResult concrete types public #40656
Comments
- public List<string> AuthenticationSchemes { get; init; }
+ public IReadOnlyList<string> AuthenticationSchemes { get; }
|
@pranavkm, thanks for taking a look at this :)
The idea is to make the ctors non-public, the only api suggestion is the listed in the issue, nothing else, like default parameterless ctors. Unfortunately, i cannot make all of them sealed because few of them, eg.
That is true, i missed to make the setter/ init-ers non-public in the proposal but I have them in my branch, I will update the proposal. I am sure not if change the data type will be possible, but I can take a look.
Good point and I will let it to be discussed during the review meeting. |
Unless you'd like to preserve this hierarchy for some reason (result filters are a possible reason), you could refactor this to not have a hierarchy. The hierarchy exists as a way to implementation. |
I kind of like the hierarchy but I don't see a reason to keep, other than code reuse that we can achieve with a different implementation. Also, I was reviewing this #40672, and I changed a little bit my proposal and removed all the hierarchy. |
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
API Review
+namespace Microsoft.AspNetCore.Http;
+public sealed class EmptyHttpResult : IResult
+{
+}
+public sealed partial class ContentHttpResult : IResult
+{
+ public string? Content { get; }
+ public int? StatusCode { get; }
+ public string? ContentType { get; }
+}
+public sealed class JsonHttpResult : IResult
+{
+ public string? Content { get; }
+ public int? StatusCode { get; }
+ public string? ContentType { get; }
+ public JsonSerializerOptions? JsonSerializerOptions { get; }
+}
+public sealed class OkObjectHttpResult : IResult
+{
+ public int? StatusCode { get; }
+ public object? Value { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class CreatedHttpResult : IResult
+{
+ public int? StatusCode { get; }
+ public object? Value { get; }
+ public string? Location { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class CreatedAtRouteHttpResult : IResult
+{
+ public int? StatusCode { get; }
+ public object? Value { get; }
+ public string? RouteName { get; }
+ public RouteValueDictionary? RouteValues { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class AcceptedHttpResult : IResult
+{
+ public int? StatusCode { get; }
+ public object? Value { get; }
+ public string? Location { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class AcceptedHttpResult : IResult
+{
+ public int? StatusCode { get; }
+ public object? Value { get; }
+ public string? RouteName { get; }
+ public RouteValueDictionary? RouteValues { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public class NoContentHttpResult : IResult
+{
+ public int? StatusCode { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed partial class RedirectToRouteHttpResult : IResult
+{
+ public string? Fragment { get; }
+ public string? RouteName { get; }
+ public RouteValueDictionary? RouteValues { get; }
+ public bool Permanent { get; }
+ public bool PreserveMethod { get; }
+ public bool AcceptLocalUrlOnly { get; }
+ public string? Url { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed partial class RedirectHttpResult : IResult
+{
+ public bool AcceptLocalUrlOnly { get; }
+ public bool Permanent { get; }
+ public bool PreserveMethod { get; }
+ public string? Url { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed class BadRequestObjectHttpResult : IResult
+{
+ public int? StatusCode { get; }
+ public object? Value { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class UnauthorizedHttpResult : IResult
+{
+ public int? StatusCode { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class NotFoundObjectHttpResult : IResult
+{
+ public int? StatusCode { get; }
+ public object? Value { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class ConflictObjectHttpResult : IResult
+{
+ public int? StatusCode { get; }
+ public object? Value { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class UnprocessableEntityObjectHttpResult : IResult
+{
+ public int? StatusCode { get; }
+ public object? Value { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class ProblemHttpResult : IResult
+{
+ public ProblemDetails ProblemDetails { get; }
+ public string ContentType { get ;}
+ public int? StatusCode { get; }
+ public object? Value { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed partial class ChallengeHttpResult : IResult
+{
+ public IReadOnlyList<string> AuthenticationSchemes { get; }
+ public AuthenticationProperties? Properties { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed partial class SignOutHttpResult : IResult
+{
+ public IReadOnlyList<string> AuthenticationSchemes { get; }
+ public AuthenticationProperties? Properties { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed partial class SignInHttpResult : IResult
+{
+ public string? AuthenticationScheme { get; }
+ public AuthenticationProperties? Properties { get; }
+ public ClaimsPrincipal Principal { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed partial class ForbidHttpResult : IResult
+{
+ public IReadOnlyList<string> AuthenticationSchemes { get; }
+ public AuthenticationProperties? Properties { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed class VirtualFileHttpResult : IResult
+{
+ public string ContentType { get; }
+ public string FileDownloadName { get; }
+ public DateTimeOffset? LastModified { get; }
+ public EntityTagHeaderValue? EntityTag { get; }
+ public bool EnableRangeProcessing { get; }
+ public long? FileLength { get; }
+ public string FileName { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed class PhysicalFileHttpResult : IResult
+{
+ public string ContentType { get; }
+ public string FileDownloadName { get; }
+ public DateTimeOffset? LastModified { get; }
+ public EntityTagHeaderValue? EntityTag { get; }
+ public bool EnableRangeProcessing { get; }
+ public long? FileLength { get; }
+ public string FileName { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed class FileStreamHttpResult : IResult
+{
+ public string ContentType { get; }
+ public string FileDownloadName { get; }
+ public DateTimeOffset? LastModified { get; }
+ public EntityTagHeaderValue? EntityTag { get; }
+ public bool EnableRangeProcessing { get; }
+ public long? FileLength { get; }
+ public Stream FileStream { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed class PushStreamHttpResult : IResult
+{
+ public string ContentType { get; }
+ public string FileDownloadName { get; }
+ public DateTimeOffset? LastModified { get; }
+ public EntityTagHeaderValue? EntityTag { get; }
+ public bool EnableRangeProcessing { get; }
+ public long? FileLength { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed class FileContentHttpResult : IResult
+{
+ public string ContentType { get; }
+ public string FileDownloadName { get; }
+ public DateTimeOffset? LastModified { get; }
+ public EntityTagHeaderValue? EntityTag { get; }
+ public bool EnableRangeProcessing { get; }
+ public long? FileLength { get; }
+ public ReadOnlyMemory<byte> FileContents { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+} The exact signatures of the constructors still need to be determined. |
@halter73 Here is the API updated with the proposal +namespace Microsoft.AspNetCore.Http;
+public sealed class EmptyHttpResult : IResult
+{
+ public static readonly EmptyHttpResult Instance;
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed partial class ContentHttpResult : IResult
+{
+ public ContentHttpResult(string? content, string? contentType) {}
+ public ContentHttpResult(string? content, string? contentType, int? statusCode) {}
+ public string? Content { get; }
+ public int? StatusCode { get; }
+ public string? ContentType { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class JsonHttpResult : IResult
+{
+ public JsonHttpResult(object? value, JsonSerializerOptions? jsonSerializerOptions) {}
+ public JsonHttpResult(object? value, int? statusCode, JsonSerializerOptions? jsonSerializerOptions) {}
+ public JsonHttpResult(object? value, string? contentType, JsonSerializerOptions? jsonSerializerOptions) {}
+ public JsonHttpResult(object? value, int? statusCode, string? contentType, JsonSerializerOptions? jsonSerializerOptions) {}
+ public string? Content { get; }
+ public int? StatusCode { get; }
+ public string? ContentType { get; }
+ public JsonSerializerOptions? JsonSerializerOptions { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class OkObjectHttpResult : IResult
+{
+ public OkObjectHttpResult(object? value) {}
+ public int StatusCode { get; }
+ public object? Value { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class CreatedHttpResult : IResult
+{
+ public CreatedHttpResult(string location, object? value) {}
+ public CreatedHttpResult(Uri locationUri, object? value) {}
+ public int StatusCode { get; }
+ public object? Value { get; }
+ public string? Location { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class CreatedAtRouteHttpResult : IResult
+{
+ public CreatedAtRouteHttpResult(object? routeValues, object? value) {}
+ public CreatedAtRouteHttpResult(string? routeName, object? routeValues, object? value) {}
+ public int StatusCode { get; }
+ public object? Value { get; }
+ public string? RouteName { get; }
+ public RouteValueDictionary? RouteValues { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class AcceptedHttpResult : IResult
+{
+ public AcceptedHttpResult(string location, object? value) {}
+ public AcceptedHttpResult(Uri locationUri, object? value) {}
+ public int StatusCode { get; }
+ public object? Value { get; }
+ public string? Location { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class AcceptedHttpResult : IResult
+{
+ public AcceptedHttpResult(object? routeValues, object? value) {}
+ public AcceptedHttpResult(string? routeName, object? routeValues, object? value) {}
+ public int StatusCode { get; }
+ public object? Value { get; }
+ public string? RouteName { get; }
+ public RouteValueDictionary? RouteValues { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public class NoContentHttpResult : IResult
+{
+ public NoContentHttpResult() {}
+ public intStatusCode { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed partial class RedirectToRouteHttpResult : IResult
+{
+ public RedirectToRouteHttpResult(object? routeValues) {}
+ public RedirectToRouteHttpResult(string? routeName, object? routeValues) {}
+ public RedirectToRouteHttpResult(string? routeName, object? routeValues, bool permanent) {}
+ public RedirectToRouteHttpResult(string? routeName, object? routeValues, bool permanent, bool preserveMethod) {}
+ public RedirectToRouteHttpResult(string? routeName, object? routeValues, string? fragment) {}
+ public RedirectToRouteHttpResult(string? routeName, object? routeValues, bool permanent, string? fragment) {}
+ public RedirectToRouteHttpResult(string? routeName, object? routeValues, bool permanent, bool preserveMethod, string? fragment) {}
+ public string? Fragment { get; }
+ public string? RouteName { get; }
+ public RouteValueDictionary? RouteValues { get; }
+ public bool Permanent { get; }
+ public bool PreserveMethod { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed partial class RedirectHttpResult : IResult
+{
+ public RedirectHttpResult(string url) {}
+ public RedirectHttpResult(string url, bool permanent) {}
+ public RedirectHttpResult(string url, bool permanent, bool preserveMethod) {}
+ public RedirectHttpResult(string url, bool acceptLocalUrlOnly, bool permanent, bool preserveMethod) {}
+ public bool AcceptLocalUrlOnly { get; }
+ public bool Permanent { get; }
+ public bool PreserveMethod { get; }
+ public string? Url { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed class BadRequestObjectHttpResult : IResult
+{
+ public BadRequestObjectHttpResult(object? error){}
+ public int StatusCode { get; }
+ public object? Value { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class UnauthorizedHttpResult : IResult
+{
+ public UnauthorizedHttpResult() {}
+ public int StatusCode { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class NotFoundObjectHttpResult : IResult
+{
+ public NotFoundObjectHttpResult(object? value) {}
+ public int StatusCode { get; }
+ public object? Value { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class ConflictObjectHttpResult : IResult
+{
+ public ConflictObjectHttpResult(object? error) {}
+ public int StatusCode { get; }
+ public object? Value { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class UnprocessableEntityObjectHttpResult : IResult
+{
+ public UnprocessableEntityObjectHttpResult(object? error) {}
+ public int StatusCode { get; }
+ public object? Value { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed class ProblemHttpResult : IResult
+{
+ public ProblemHttpResult(ProblemDetails problemDetails) {}
+ public ProblemDetails ProblemDetails { get; }
+ public string ContentType { get ;}
+ public int? StatusCode { get; }
+ public object? Value { get; }
+ public Task ExecuteAsync(HttpContext httpContext) {}
+}
+public sealed partial class ChallengeHttpResult : IResult
+{
+ public ChallengeHttpResult() {}
+ public ChallengeHttpResult(string authenticationScheme) {}
+ public ChallengeHttpResult(IList<string> authenticationSchemes) {}
+ public ChallengeHttpResult(AuthenticationProperties? properties) {}
+ public ChallengeHttpResult(string authenticationScheme, AuthenticationProperties? properties) {}
+ public ChallengeHttpResult(IList<string> authenticationSchemes, AuthenticationProperties? properties) {}
+ public IReadOnlyList<string> AuthenticationSchemes { get; }
+ public AuthenticationProperties? Properties { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed partial class SignOutHttpResult : IResult
+{
+ public SignOutHttpResult() {}
+ public SignOutHttpResult(string authenticationScheme) {}
+ public SignOutHttpResult(IList<string> authenticationSchemes) {}
+ public SignOutHttpResult(AuthenticationProperties? properties) {}
+ public SignOutHttpResult(string authenticationScheme, AuthenticationProperties? properties) {}
+ public SignOutHttpResult(IList<string> authenticationSchemes, AuthenticationProperties? properties) {}
+ public IReadOnlyList<string> AuthenticationSchemes { get; }
+ public AuthenticationProperties? Properties { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed partial class SignInHttpResult : IResult
+{
+ public SignInHttpResult(ClaimsPrincipal principal) {}
+ public SignInHttpResult(ClaimsPrincipal principal, string? authenticationScheme, AuthenticationProperties? properties) {}
+ public string? AuthenticationScheme { get; }
+ public AuthenticationProperties? Properties { get; }
+ public ClaimsPrincipal Principal { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed partial class ForbidHttpResult : IResult
+{
+ public ForbidHttpResult() {}
+ public ForbidHttpResult(string authenticationScheme) {}
+ public ForbidHttpResult(IList<string> authenticationSchemes) {}
+ public ForbidHttpResult(AuthenticationProperties? properties) {}
+ public ForbidHttpResult(string authenticationScheme, AuthenticationProperties? properties) {}
+ public ForbidHttpResult(IList<string> authenticationSchemes, AuthenticationProperties? properties) {}
+ public IReadOnlyList<string> AuthenticationSchemes { get; }
+ public AuthenticationProperties? Properties { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed class VirtualFileHttpResult : IResult
+{
+ public VirtualFileHttpResult(string fileName, string? contentType) {}
+ public VirtualFileHttpResult(string fileName, string? contentType, string? fileDownloadName) {}
+ public VirtualFileHttpResult(string fileName, string? contentType, string? fileDownloadName, bool enableRangeProcessing, DateTimeOffset? lastModified = null, EntityTagHeaderValue? entityTag = null) {}
+ public string ContentType { get; }
+ public string FileDownloadName { get; }
+ public DateTimeOffset? LastModified { get; }
+ public EntityTagHeaderValue? EntityTag { get; }
+ public bool EnableRangeProcessing { get; }
+ public long? FileLength { get; }
+ public string FileName { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed class PhysicalFileHttpResult : IResult
+{
+ public PhysicalFileHttpResult(string fileName, string? contentType) {}
+ public PhysicalFileHttpResult(string fileName, string? contentType, string? fileDownloadName) {}
+ public PhysicalFileHttpResult(string fileName, string? contentType, string? fileDownloadName, bool enableRangeProcessing, DateTimeOffset? lastModified = null, EntityTagHeaderValue? entityTag = null) {}
+ public string ContentType { get; }
+ public string FileDownloadName { get; }
+ public DateTimeOffset? LastModified { get; }
+ public EntityTagHeaderValue? EntityTag { get; }
+ public bool EnableRangeProcessing { get; }
+ public long? FileLength { get; }
+ public string FileName { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed class FileStreamHttpResult : IResult
+{
+ public FileStreamHttpResult(Stream fileStream, string? contentType) {}
+ public FileStreamHttpResult(Stream fileStream, string? contentType, string? fileDownloadName) {}
+ public FileStreamHttpResult(Stream fileStream, string? contentType, string? fileDownloadName, bool enableRangeProcessing, DateTimeOffset? lastModified = null, EntityTagHeaderValue? entityTag = null) {}
+ public string ContentType { get; }
+ public string FileDownloadName { get; }
+ public DateTimeOffset? LastModified { get; }
+ public EntityTagHeaderValue? EntityTag { get; }
+ public bool EnableRangeProcessing { get; }
+ public long? FileLength { get; }
+ public Stream FileStream { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed class PushStreamHttpResult : IResult
+{
+ public PushStreamHttpResult(Func<Stream, Task> streamWriterCallback, string? contentType) {}
+ public PushStreamHttpResult(Func<Stream, Task> streamWriterCallback, string? contentType, string? fileDownloadName) {}
+ public PushStreamHttpResult(Func<Stream, Task> streamWriterCallback, string? contentType, string? fileDownloadName, bool enableRangeProcessing, DateTimeOffset? lastModified = null, EntityTagHeaderValue? entityTag = null) {}
+ public string ContentType { get; }
+ public string FileDownloadName { get; }
+ public DateTimeOffset? LastModified { get; }
+ public EntityTagHeaderValue? EntityTag { get; }
+ public bool EnableRangeProcessing { get; }
+ public long? FileLength { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+}
+public sealed class FileContentHttpResult : IResult
+{
+ public FileContentHttpResult(ReadOnlyMemory<byte> fileContents, string? contentType) {}
+ public FileContentHttpResult(ReadOnlyMemory<byte> fileContents, string? contentType, string? fileDownloadName) {}
+ public FileContentHttpResult(ReadOnlyMemory<byte> fileContents, string? contentType, string? fileDownloadName, bool enableRangeProcessing, DateTimeOffset? lastModified = null, EntityTagHeaderValue? entityTag = null) {}
+ public string ContentType { get; }
+ public string FileDownloadName { get; }
+ public DateTimeOffset? LastModified { get; }
+ public EntityTagHeaderValue? EntityTag { get; }
+ public bool EnableRangeProcessing { get; }
+ public long? FileLength { get; }
+ public ReadOnlyMemory<byte> FileContents { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+} Also, this type that was not listed before: +namespace Microsoft.AspNetCore.Http;
+public sealed partial class StatusCodeHttpResult : IResult
+{
+ public StatusCodeHttpResult(int statusCode) {}
+ public int StatusCode { get; }
+ public Task ExecuteAsync(HttpContext httpContext);
+} |
Let's hold of on the public constructors and make them internal for preview3 (even the implicit default ones if any) so we have more time to consider them in API review preview4. I'm fine with keeping public static EmptyHttpResult Instance { get; } |
I have created a follow up issue for this #40802 . |
Background and Motivation
Today, all Http Results are
internal sealed
types and the only public parts are:ExecuteAsync
method.Because it is extremely minimalist, it became far more complicated to create a simple test like this:
The issue #37502 reported the problem and describe a current working complext
Unit test
sample, that basically executes the result and checks theMock<HttpContext>
information.Proposed API
This proposal is following these general ideas:
HttpResult
suffixResult
creation must be fromResults
static classInterfaces
IResult
that when executed will do nothingAn
IResult
that when executed will produce a response with contentAn
IResult
that when executed will produce a JSON responseAn
IResult
that on execution will write an object to the response with the Ok (200) status codeAn
IResult
that on execution will write an object to the response with Created (201) status code and Location headerAn
IResult
that on execution will write an object to the response with Created (201) status code and Location header to a registered route locationAn
IResult
that on execution will write an object to the response with Accepted (202) status code and Location headerAn
IResult
that on execution will write an object to the response with Accepted (202) status code and Location header to a registered route locationAn
IResult
that on execution will produces response with the No Content (204) status codeAn
IResult
that returns aFound (302)
,Moved Permanently (301)
,Temporary Redirect (307)
orPermanent Redirect (308)
response with a Location header to a registered route locationAn
IResult
that returns aFound (302)
,Moved Permanently (301)
,Temporary Redirect (307)
orPermanent Redirect (308)
response with a Location header to the supplied URLAn
IResult
that on execution will write an object to the response with the Bad Request (400) status codeAn
IResult
that on execution will produces response with the Unauthorized (401) status codeAn
IResult
that on execution will write an object to the response with the Not Found (404) status codeAn
IResult
that on execution will write an object to the response with the Conflict (409) status codeAn
IResult
that on execution will write an object to the response with the Unprocessable Entity (422) status codeAn
IResult
that on execution will write Problem Details HTTP API responses based on https://tools.ietf.org/html/rfc7807An
IResult
that on execution invokesHttpContext.ChallengeAsync
An
IResult
that on execution invokesHttpContext.SignOutAsync
An
IResult
that on execution invokesHttpContext.SignInAsync
An
IResult
that on execution invokesHttpContext.ForbidAsync
An
IResult
that on execution writes the file specified using a virtual path to the responseAn
IResult
that on execution will write a file from disk to the responseAn
IResult
that when executed will write a file from a stream to the responseAn
IResult
that when executed will write a file from the writer callback to the responseAn
IResult
that when executed will write a file from the content to the response to the responseUsage Examples
The new types could be used for unit testing Minimal API endpoints. Eg.:
Alternative Designs
Since
Microsoft.AspNetCore.Http
is an auto-imported global namespace for all apps targeting the WebSDK, we could think about using a different namespace.Here are few options:
Microsoft.AspNetCore.Http.Endpoints
Microsoft.AspNetCore.Http.Endpoints.Results
Microsoft.AspNetCore.Http.RouteHandling
Microsoft.AspNetCore.Http.RouteHandling.Results
Risks
The proposal is to expose the minimal as possible of the implementation, however, once the types became
public
we will not have the flexibility to change them anymore.The text was updated successfully, but these errors were encountered: