Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Add Http Response Codes to doc comments #5867

Merged
merged 1 commit into from Mar 6, 2017

Conversation

ryanbrandenburg
Copy link
Contributor

Fixes #5855.

@@ -258,7 +258,7 @@ public virtual ObjectResult StatusCode(int statusCode, object value)
}

/// <summary>
/// Creates a <see cref="ContentResult"/> object by specifying a <paramref name="content"/> string.
/// Creates a <see cref="ContentResult"/> object (HTTP 200) by specifying a <paramref name="content"/> string.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to homoginize these with the existing status code messages, but it's kind of hard to fit OK (200) in. Wording suggestions? My best idea was ...specifying a <paramref name="content"/> string with OK (200). but even that seemed kind of stilted.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not write <see cref="StatusCodes.Status200OK"/> instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like this idea, I'll update the PR.

@@ -1306,15 +1306,15 @@ public virtual ChallengeResult Challenge(AuthenticationProperties properties)
=> new ChallengeResult(authenticationSchemes, properties);

/// <summary>
/// Creates a <see cref="ForbidResult"/>.
/// Creates a <see cref="ForbidResult"/> (HTTP 403).
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, though a 403 response is what happens by default when calling this method, there's no guarantee about that, as the status code is actually specific to the handler that handles the ForbidResult.
For instance, the cookies middleware will redirect the user to the "access denied page" (302) instead of returning an empty 403 response.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By this logic we wouldn't include any status codes in these comments because any of them could be modified by a middleware. I think we're ok with these being overriden in some cases as long as the convey the intended behavior. @Eilon do you agree?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe say (HTTP 403 by default)? I want to make sure we don't throw the baby out with the bathwater here.

I'd be fine if, for example, in the <remarks> section it mentioned that some authentication schemes, such as cookies, will typically convert the HTTP 403 to an HTTP redirect to show the user a login page.

@ryanbrandenburg
Copy link
Contributor Author

🆙📅

@kevinchalet
Copy link
Contributor

Out of curiosity, why doesn't Challenge have the same kind of comment? 😄

@Eilon
Copy link
Member

Eilon commented Mar 3, 2017

@PinpointTownes yeah I would think so. @ryanbrandenburg can you update that as well?

@ryanbrandenburg
Copy link
Contributor Author

Did we want to give possible StatusCodes of SignIn and SignOut too or do we think the result of them likely enough to be different as not to mention it?

Copy link
Member

@Eilon Eilon left a comment

Choose a reason for hiding this comment

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

I think this change as-is is a great improvement over what we have, so let's :shipit:

Copy link
Contributor

@ajaybhargavb ajaybhargavb left a comment

Choose a reason for hiding this comment

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

:shipit:

@@ -258,7 +258,7 @@ public virtual ObjectResult StatusCode(int statusCode, object value)
}

/// <summary>
/// Creates a <see cref="ContentResult"/> object by specifying a <paramref name="content"/> string.
/// Creates a <see cref="ContentResult"/> object with <see cref="StatusCodes.Status200OK"/> by specifying a <paramref name="content"/> string.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Could break it down to two lines. Applies to few other places in this file

@ryanbrandenburg ryanbrandenburg merged commit de1d091 into dev Mar 6, 2017
@ryanbrandenburg ryanbrandenburg deleted the rybrande/HttpResponseCode branch March 6, 2017 18:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants