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

Unable to return non-standard (e.g. >= 512) HTTP status codes #1852

Closed
jpdillingham opened this issue Aug 22, 2023 · 2 comments
Closed

Unable to return non-standard (e.g. >= 512) HTTP status codes #1852

jpdillingham opened this issue Aug 22, 2023 · 2 comments

Comments

@jpdillingham
Copy link

I have a use case that lends itself to using user-defined HTTP status codes, particularly those at or above 512, which are unassigned per the IANA registry. I haven't found anything in the public API that allows me to create HttpResponseData with an integer instead of a member of HttpStatusCode (which is impossible given the design of this class)

Am I missing something, or is this unsupported? And if unsupported, is there rationale that isn't obvious?

@jviau
Copy link
Contributor

jviau commented Oct 13, 2023

@jpdillingham you can accomplish this by casting:

request.CreateResponse((HttpStatusCode)513);

Enums are just facades over int in C#

@microsoft-github-policy-service
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants