Skip to content

Commit 2f97374

Browse files
committed
http.GetStatusDescription will no longer throw an error that the server is a teapot if the error code is unknown.
1 parent 7d82dea commit 2f97374

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lua/gpm/utils.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ local codes = {
438438
[409] = {"Conflict", "The server encountered a conflict with the request sent with the current state of the server"},
439439
[410] = {"Gone", "The requested content has been deleted from the server"},
440440
[411] = {"Length Required", "The server rejected the request because the Content-Length is not defined"},
441+
[418] = {"I'm a teapot", "This client error response code indicates that the server refuses to brew coffee because it is, permanently, a teapot."},
441442
[429] = {"Rate limit reached for requests", "This error message indicates that you have hit your assigned rate limit for the API"},
442443

443444
--[[--------------------
@@ -455,9 +456,7 @@ local codes = {
455456

456457
function http.GetStatusDescription( code )
457458
local data = codes[ code ]
458-
if not data then
459-
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."
459+
if data then
460+
return data[ 1 ], data[ 2 ]
460461
end
461-
462-
return data[ 1 ], data[ 2 ]
463462
end

0 commit comments

Comments
 (0)