mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-09-12 19:51:02 +05:00
Hmmmm
This commit is contained in:
parent
83c92f8dc7
commit
fe43dacde5
@ -47,14 +47,17 @@ end
|
||||
|
||||
local function rawRequest(url, postData, headers, chunkHandler, chunkSize, method)
|
||||
local pcallSuccess, requestHandle, requestReason = pcall(component.get("internet").request, url, postData, headers, method)
|
||||
|
||||
if pcallSuccess then
|
||||
if requestHandle then
|
||||
while true do
|
||||
local chunk, reason = requestHandle.read(chunkSize or math.huge)
|
||||
local chunk, reason = requestHandle.read(chunkSize or math.huge)
|
||||
|
||||
if chunk then
|
||||
chunkHandler(chunk)
|
||||
else
|
||||
requestHandle:close()
|
||||
|
||||
if reason then
|
||||
return false, reason
|
||||
else
|
||||
@ -63,7 +66,7 @@ local function rawRequest(url, postData, headers, chunkHandler, chunkSize, metho
|
||||
end
|
||||
end
|
||||
else
|
||||
return false, "Invalid URL-address"
|
||||
return false, requestReason or "Invalid URL-address"
|
||||
end
|
||||
else
|
||||
return false, "Invalid arguments to internet.request"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user