Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ All status codes defined in the following RFCs are supported:
* RFC6585 (Additional HTTP Status Codes)
* RFC7538 (Permanent Redirect)
* RFC8297 (An HTTP Status Code for Indicating Hints)
* RFC8470 (Using Early Data in HTTP)

TypeScript or JavaScript. Completely library agnostic. No dependencies.

Expand Down Expand Up @@ -95,6 +96,7 @@ response
| 422 | UNPROCESSABLE_ENTITY | Unprocessable Entity |
| 423 | LOCKED | Locked |
| 424 | FAILED_DEPENDENCY | Failed Dependency |
| 425 | TOO_EARLY | Too Early |
| 426 | UPGRADE_REQUIRED | Upgrade Required |
| 428 | PRECONDITION_REQUIRED | Precondition Required |
| 429 | TOO_MANY_REQUESTS | Too Many Requests |
Expand Down
9 changes: 9 additions & 0 deletions codes.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@
"description": "The request failed due to failure of a previous request."
}
},
{
"code": 425,
"phrase": "Too Early",
"constant": "TOO_EARLY",
"comment": {
"doc": "Official Documentation @ https://www.rfc-editor.org/rfc/rfc8470#section-5.2",
"description": "The server is unwilling to risk processing a request that might be replayed."
}
},
{
"code": 403,
"phrase": "Forbidden",
Expand Down
6 changes: 6 additions & 0 deletions src/reason-phrases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ export enum ReasonPhrases {
* The request failed due to failure of a previous request.
*/
FAILED_DEPENDENCY = "Failed Dependency",
/**
* Official Documentation @ https://www.rfc-editor.org/rfc/rfc8470#section-5.2
*
* The server is unwilling to risk processing a request that might be replayed.
*/
TOO_EARLY = "Too Early",
/**
* Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.3
*
Expand Down
6 changes: 6 additions & 0 deletions src/status-codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ export enum StatusCodes {
* The request failed due to failure of a previous request.
*/
FAILED_DEPENDENCY = 424,
/**
* Official Documentation @ https://www.rfc-editor.org/rfc/rfc8470#section-5.2
*
* The server is unwilling to risk processing a request that might be replayed.
*/
TOO_EARLY = 425,
/**
* Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.15
*
Expand Down
2 changes: 2 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const statusCodeToReasonPhrase: Record<string, string> = {
"201": "Created",
"417": "Expectation Failed",
"424": "Failed Dependency",
"425": "Too Early",
"403": "Forbidden",
"504": "Gateway Timeout",
"410": "Gone",
Expand Down Expand Up @@ -68,6 +69,7 @@ export const reasonPhraseToStatusCode: Record<string, number> = {
"Created": 201,
"Expectation Failed": 417,
"Failed Dependency": 424,
"Too Early": 425,
"Forbidden": 403,
"Gateway Timeout": 504,
"Gone": 410,
Expand Down