Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add client error `Too_many_requests #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions lib/httpaf.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions lib/status.ml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type client_error = [
| `I_m_a_teapot
| `Enhance_your_calm
| `Upgrade_required
| `Too_many_requests
]

type server_error = [
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down