Diff

net/http/codes.lua @ 10370:78bda7932f17

net.http.codes: Avoid implicit number -> string coercion
author Kim Alvefur <zash@zash.se>
date Fri, 01 Nov 2019 23:18:29 +0100
parent 9170:47ffce31ffe4
child 12548:5133d6e48686
line wrap: on
line diff
--- a/net/http/codes.lua	Fri Nov 01 23:16:58 2019 +0100
+++ b/net/http/codes.lua	Fri Nov 01 23:18:29 2019 +0100
@@ -82,5 +82,5 @@
 	-- [512-599] = "Unassigned";
 };
 
-for k,v in pairs(response_codes) do response_codes[k] = k.." "..v; end
+for k,v in pairs(response_codes) do response_codes[k] = ("%03d %s"):format(k, v); end
 return setmetatable(response_codes, { __index = function(_, k) return k.." Unassigned"; end })