Changeset

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
parents 10369:9d20fca6a485
children 10371:228338120009
files net/http/codes.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
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 })