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

[bug]: allow custom http codes #664

Closed
alexanderGalushka opened this issue May 19, 2020 · 3 comments · Fixed by #855
Closed

[bug]: allow custom http codes #664

alexanderGalushka opened this issue May 19, 2020 · 3 comments · Fixed by #855

Comments

@alexanderGalushka
Copy link

e.g. returning status 555 gives this:

error: Uncaught InvalidData: Bad status code
    throw new Deno.errors.InvalidData("Bad status code");
@alexanderGalushka
Copy link
Author

what is the reason to lock down the list of allowed http codes https://github.com/denoland/deno/blob/bced52505f32d6cca4f944bb610a8a26767908a8/std/http/http_status.ts#L131 ?

@alexanderGalushka
Copy link
Author

not compliant with https://tools.ietf.org/html/rfc2616

HTTP status codes are extensible. HTTP applications are not required
to understand the meaning of all registered status codes, though such
understanding is obviously desirable. However, applications MUST
understand the class of any status code, as indicated by the first
digit, and treat any unrecognized response as being equivalent to the
x00 status code of that class, with the exception that an
unrecognized response MUST NOT be cached. For example, if an
unrecognized status code of 431 is received by the client, it can
safely assume that there was something wrong with its request and
treat the response as if it had received a 400 status code. In such
cases, user agents SHOULD present to the user the entity returned
with the response, since that entity is likely to include human-
readable information which will explain the unusual status.

@tkgalk
Copy link
Contributor

tkgalk commented May 21, 2020

I'll gladly take a stab at it.

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