Skip to content

Commit

Permalink
http.GetStatusDescription will no longer throw an error that the se…
Browse files Browse the repository at this point in the history
…rver is a teapot if the error code is unknown.
  • Loading branch information
unknown-gd committed Aug 31, 2023
1 parent 7d82dea commit 2f97374
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lua/gpm/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ local codes = {
[409] = {"Conflict", "The server encountered a conflict with the request sent with the current state of the server"},
[410] = {"Gone", "The requested content has been deleted from the server"},
[411] = {"Length Required", "The server rejected the request because the Content-Length is not defined"},
[418] = {"I'm a teapot", "This client error response code indicates that the server refuses to brew coffee because it is, permanently, a teapot."},
[429] = {"Rate limit reached for requests", "This error message indicates that you have hit your assigned rate limit for the API"},

--[[--------------------
Expand All @@ -455,9 +456,7 @@ local codes = {

function http.GetStatusDescription( code )
local data = codes[ code ]
if not data then
return "I'm a teapot", "Any attempt to brew coffee with a teapot should result in the error code \"418 I'm a teapot\". The resulting entity body MAY be short and stout."
if data then
return data[ 1 ], data[ 2 ]
end

return data[ 1 ], data[ 2 ]
end

0 comments on commit 2f97374

Please sign in to comment.