Skip to content
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

Introducing I*HttpResult interfaces #42385

Merged

Conversation

brunolins16
Copy link
Member

@brunolins16 brunolins16 commented Jun 23, 2022

Close #42187

@ghost ghost added the area-runtime label Jun 23, 2022
@brunolins16 brunolins16 marked this pull request as ready for review June 28, 2022 20:35
@brunolins16 brunolins16 requested review from DamianEdwards and a team June 28, 2022 20:36
…ult.cs

Co-authored-by: Martin Costello <martin@martincostello.com>

/// <summary>
/// Defines a contract that represents the result of an HTTP endpoint
/// that contains a nested <see cref="IResult"/> type.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a remark about the Result<T1, T2> type?

@@ -37,7 +41,7 @@ internal ProblemHttpResult(ProblemDetails problemDetails)
/// <summary>
/// Gets the HTTP status code.
/// </summary>
public int? StatusCode => ProblemDetails.Status;
public int StatusCode => ProblemDetails.Status!.Value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check for null and use a default status code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We set the default in the constructor, and it will not be null

if (problemDetails.Status is null)

But sure, I can add a check if you prefer.

src/Http/Http.Results/test/AcceptedAtRouteResultTests.cs Outdated Show resolved Hide resolved
src/Http/Http.Results/test/CreatedOfTResultTests.cs Outdated Show resolved Hide resolved
Copy link
Member

@davidfowl davidfowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@brunolins16 brunolins16 enabled auto-merge (squash) July 7, 2022 16:00
@brunolins16 brunolins16 merged commit 3f57865 into dotnet:main Jul 7, 2022
@ghost ghost added this to the 7.0-preview7 milestone Jul 7, 2022
@brunolins16 brunolins16 deleted the brunolins16/issues/results-interfaces branch August 2, 2022 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce interfaces to describe IResult types
4 participants