From 879e88c49621383919d0adf6379bb693982d6e70 Mon Sep 17 00:00:00 2001 From: Bryce Neal Date: Wed, 20 Sep 2023 11:56:16 +0200 Subject: [PATCH] Build 103 and 426 --- README.md | 2 ++ src/reason-phrases.ts | 12 ++++++++++++ src/status-codes.ts | 12 ++++++++++++ src/utils.ts | 4 ++++ 4 files changed, 30 insertions(+) diff --git a/README.md b/README.md index 0458221..f3c2568 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ response | 100 | CONTINUE | Continue | | 101 | SWITCHING_PROTOCOLS | Switching Protocols | | 102 | PROCESSING | Processing | +| 103 | EARLY_HINTS | Early Hints | | 200 | OK | OK | | 201 | CREATED | Created | | 202 | ACCEPTED | Accepted | @@ -87,6 +88,7 @@ response | 422 | UNPROCESSABLE_ENTITY | Unprocessable Entity | | 423 | LOCKED | Locked | | 424 | FAILED_DEPENDENCY | Failed Dependency | +| 426 | UPGRADE_REQUIRED | Upgrade Required | | 428 | PRECONDITION_REQUIRED | Precondition Required | | 429 | TOO_MANY_REQUESTS | Too Many Requests | | 431 | REQUEST_HEADER_FIELDS_TOO_LARGE | Request Header Fields Too Large | diff --git a/src/reason-phrases.ts b/src/reason-phrases.ts index 6e0ae40..1ecb83e 100644 --- a/src/reason-phrases.ts +++ b/src/reason-phrases.ts @@ -233,6 +233,18 @@ export enum ReasonPhrases { * This code indicates that the server has received and is processing the request, but no response is available yet. */ PROCESSING = "Processing", + /** + * Official Documentation @ https://www.rfc-editor.org/rfc/rfc8297#page-3 + * + * This code indicates to the client that the server is likely to send a final response with the header fields included in the informational response. + */ + EARLY_HINTS = "Early Hints", + /** + * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.15 + * + * The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol. + */ + UPGRADE_REQUIRED = "Upgrade Required", /** * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.2 * diff --git a/src/status-codes.ts b/src/status-codes.ts index ab99858..c20c323 100644 --- a/src/status-codes.ts +++ b/src/status-codes.ts @@ -18,6 +18,12 @@ export enum StatusCodes { * This code indicates that the server has received and is processing the request, but no response is available yet. */ PROCESSING = 102, + /** + * Official Documentation @ https://www.rfc-editor.org/rfc/rfc8297#page-3 + * + * This code indicates to the client that the server is likely to send a final response with the header fields included in the informational response. + */ + EARLY_HINTS = 103, /** * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.1 * @@ -270,6 +276,12 @@ export enum StatusCodes { * The request failed due to failure of a previous request. */ FAILED_DEPENDENCY = 424, + /** + * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.15 + * + * The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol. + */ + UPGRADE_REQUIRED = 426, /** * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-3 * diff --git a/src/utils.ts b/src/utils.ts index f74ec23..d70f02d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -38,6 +38,8 @@ export const statusCodeToReasonPhrase: Record = { "412": "Precondition Failed", "428": "Precondition Required", "102": "Processing", + "103": "Early Hints", + "426": "Upgrade Required", "407": "Proxy Authentication Required", "431": "Request Header Fields Too Large", "408": "Request Timeout", @@ -96,6 +98,8 @@ export const reasonPhraseToStatusCode: Record = { "Precondition Failed": 412, "Precondition Required": 428, "Processing": 102, + "Early Hints": 103, + "Upgrade Required": 426, "Proxy Authentication Required": 407, "Request Header Fields Too Large": 431, "Request Timeout": 408,