Skip to content

Commit

Permalink
Run code generation for 421 addition
Browse files Browse the repository at this point in the history
  • Loading branch information
prettymuchbryce committed Oct 6, 2021
1 parent 68dd311 commit 661b3a9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ response
| 418 | IM_A_TEAPOT | I'm a teapot |
| 419 | INSUFFICIENT_SPACE_ON_RESOURCE | Insufficient Space on Resource |
| 420 | METHOD_FAILURE | Method Failure |
| 421 | MISDIRECTED_REQUEST | Misdirected Request |
| 422 | UNPROCESSABLE_ENTITY | Unprocessable Entity |
| 423 | LOCKED | Locked |
| 424 | FAILED_DEPENDENCY | Failed Dependency |
Expand Down
8 changes: 7 additions & 1 deletion src/reason-phrases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,5 +335,11 @@ export enum ReasonPhrases {
*
* Was defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy.
*/
USE_PROXY = "Use Proxy"
USE_PROXY = "Use Proxy",
/**
* Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7540#section-9.1.2
*
* Defined in the specification of HTTP/2 to indicate that a server is not able to produce a response for the combination of scheme and authority that are included in the request URI.
*/
MISDIRECTED_REQUEST = "Misdirected Request"
}
8 changes: 7 additions & 1 deletion src/status-codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,5 +335,11 @@ export enum StatusCodes {
*
* Was defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy.
*/
USE_PROXY = 305
USE_PROXY = 305,
/**
* Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7540#section-9.1.2
*
* Defined in the specification of HTTP/2 to indicate that a server is not able to produce a response for the combination of scheme and authority that are included in the request URI.
*/
MISDIRECTED_REQUEST = 421
}
6 changes: 4 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const statusCodeToReasonPhrase: Record<string, string> = {
"451": "Unavailable For Legal Reasons",
"422": "Unprocessable Entity",
"415": "Unsupported Media Type",
"305": "Use Proxy"
"305": "Use Proxy",
"421": "Misdirected Request"
};
export const reasonPhraseToStatusCode: Record<string, number> = {
"Accepted": 202,
Expand Down Expand Up @@ -111,5 +112,6 @@ export const reasonPhraseToStatusCode: Record<string, number> = {
"Unavailable For Legal Reasons": 451,
"Unprocessable Entity": 422,
"Unsupported Media Type": 415,
"Use Proxy": 305
"Use Proxy": 305,
"Misdirected Request": 421
};

0 comments on commit 661b3a9

Please sign in to comment.