Created
October 17, 2020 21:50
-
-
Save Core-commits/0eaaa00eac5e89e68631fedd72831675 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local http = require "socket.http" | |
local data = "" | |
local function collect(chunk) | |
if chunk ~= nil then | |
data = data .. chunk | |
end | |
return true | |
end | |
local ok, statusCode, headers, statusText = http.request { | |
method = "GET", | |
url = "http://someserver.sometld/somepath", | |
sink = collect | |
} | |
print("ok\t", ok); | |
print("statusCode", statusCode) | |
print("statusText", statusText) | |
print("headers:") | |
for i,v in pairs(headers) do | |
print("\t",i, v) | |
end | |
print("data", data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment