Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add res.redirects and res.url #231

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions deps/coro-http.lua
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,17 @@ local function request(method, url, headers, body, timeout)
for i = 1, #res do
local key, location = unpack(res[i])
if key:lower() == "location" then
headers = headers or {}
headers.redirects = headers.redirects or {}
table.insert(headers.redirects, location)
return request(method, location, headers)
end
end
end

res.redirects = headers and headers.redirects or {}
res.url = url

return res, table.concat(body)
end

Expand Down