diff --git a/README.md b/README.md index 485e812..97024c3 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 | diff --git a/codes.json b/codes.json index fdb3111..dafdddd 100644 --- a/codes.json +++ b/codes.json @@ -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", diff --git a/src/reason-phrases.ts b/src/reason-phrases.ts index 1ecb83e..40819dc 100644 --- a/src/reason-phrases.ts +++ b/src/reason-phrases.ts @@ -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 * diff --git a/src/status-codes.ts b/src/status-codes.ts index c20c323..201560a 100644 --- a/src/status-codes.ts +++ b/src/status-codes.ts @@ -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 * diff --git a/src/utils.ts b/src/utils.ts index d70f02d..663f314 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -8,6 +8,7 @@ export const statusCodeToReasonPhrase: Record = { "201": "Created", "417": "Expectation Failed", "424": "Failed Dependency", + "425": "Too Early", "403": "Forbidden", "504": "Gateway Timeout", "410": "Gone", @@ -68,6 +69,7 @@ export const reasonPhraseToStatusCode: Record = { "Created": 201, "Expectation Failed": 417, "Failed Dependency": 424, + "Too Early": 425, "Forbidden": 403, "Gateway Timeout": 504, "Gone": 410,