Comparison

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
comparison
equal deleted inserted replaced
10369:9d20fca6a485 10370:78bda7932f17
80 [510] = "Not Extended"; 80 [510] = "Not Extended";
81 [511] = "Network Authentication Required"; 81 [511] = "Network Authentication Required";
82 -- [512-599] = "Unassigned"; 82 -- [512-599] = "Unassigned";
83 }; 83 };
84 84
85 for k,v in pairs(response_codes) do response_codes[k] = k.." "..v; end 85 for k,v in pairs(response_codes) do response_codes[k] = ("%03d %s"):format(k, v); end
86 return setmetatable(response_codes, { __index = function(_, k) return k.." Unassigned"; end }) 86 return setmetatable(response_codes, { __index = function(_, k) return k.." Unassigned"; end })