From da2b3c9114957a4127b0ccb3b5e6b8a4d11b6799 Mon Sep 17 00:00:00 2001 From: Vincent Bernardoff Date: Sat, 6 Jul 2019 23:03:34 +0800 Subject: [PATCH] add client error `Too_many_requests --- lib/httpaf.mli | 1 + lib/status.ml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lib/httpaf.mli b/lib/httpaf.mli index 12ee90a5..6cb73993 100644 --- a/lib/httpaf.mli +++ b/lib/httpaf.mli @@ -211,6 +211,7 @@ module Status : sig | `Upgrade_required | `I_m_a_teapot | `Enhance_your_calm + | `Too_many_requests ] (** The 4xx (Client Error) class of status code indicates that the client seems to have erred. diff --git a/lib/status.ml b/lib/status.ml index e5dd54e9..9b99e56a 100644 --- a/lib/status.ml +++ b/lib/status.ml @@ -79,6 +79,7 @@ type client_error = [ | `I_m_a_teapot | `Enhance_your_calm | `Upgrade_required + | `Too_many_requests ] type server_error = [ @@ -144,6 +145,7 @@ let default_reason_phrase = function | `I_m_a_teapot -> "I'm a teapot" (* RFC 2342 *) | `Enhance_your_calm -> "Enhance Your Calm" | `Upgrade_required -> "Upgrade Required" + | `Too_many_requests -> "Too Many Requests" (* Server error *) | `Internal_server_error -> "Internal Server Error" | `Not_implemented -> "Not Implemented" @@ -194,6 +196,7 @@ let to_code = function | `I_m_a_teapot -> 418 | `Enhance_your_calm -> 420 | `Upgrade_required -> 426 + | `Too_many_requests -> 429 (* Server error *) | `Internal_server_error -> 500 | `Not_implemented -> 501 @@ -245,6 +248,7 @@ let really_unsafe_of_code = function | 418 -> `I_m_a_teapot | 420 -> `Enhance_your_calm | 426 -> `Upgrade_required + | 429 -> `Too_many_requests (* Server error *) | 500 -> `Internal_server_error | 501 -> `Not_implemented @@ -346,6 +350,7 @@ let to_string = function (* don't allocate *) | `I_m_a_teapot -> "418" | `Enhance_your_calm -> "420" | `Upgrade_required -> "426" + | `Too_many_requests -> "429" (* Server error *) | `Internal_server_error -> "500" | `Not_implemented -> "501"