Fix conversion of http.headers in Lua 5.1 and LuaJIT
The __pairs metamethod was introduced in 5.2, so instead of using pairs() on http.headers values, use its :each() method — which is what the __pairs metamethod calls anyway.
This commit is contained in:
@@ -23,7 +23,7 @@ end
|
|||||||
|
|
||||||
local function headers_to_dict(h)
|
local function headers_to_dict(h)
|
||||||
local headers = {}
|
local headers = {}
|
||||||
for name, value in pairs(h) do
|
for name, value in h:each() do
|
||||||
if name:sub(1, 1) ~= ":" then
|
if name:sub(1, 1) ~= ":" then
|
||||||
headers[name] = value
|
headers[name] = value
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user