mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-12 19:33:00 +00:00
Add more Checks
This commit is contained in:
@@ -709,6 +709,9 @@ if http then
|
||||
if _headers ~= nil and type( _headers ) ~= "table" then
|
||||
error( "bad argument #2 (expected table, got " .. type( _headers ) .. ")", 2 )
|
||||
end
|
||||
if _binary ~= nil and type( _binary ) ~= "boolean" then
|
||||
error( "bad argument #3 (expected boolean, got " .. type( _binary ) .. ")", 2 )
|
||||
end
|
||||
return wrapRequest( _url, nil, _headers, _binary)
|
||||
end
|
||||
|
||||
@@ -722,6 +725,9 @@ if http then
|
||||
if _headers ~= nil and type( _headers ) ~= "table" then
|
||||
error( "bad argument #3 (expected table, got " .. type( _headers ) .. ")", 2 )
|
||||
end
|
||||
if _binary ~= nil and type( _binary ) ~= "boolean" then
|
||||
error( "bad argument #4 (expected boolean, got " .. type( _binary ) .. ")", 2 )
|
||||
end
|
||||
return wrapRequest( _url, _post or "", _headers, _binary)
|
||||
end
|
||||
|
||||
@@ -735,6 +741,9 @@ if http then
|
||||
if _headers ~= nil and type( _headers ) ~= "table" then
|
||||
error( "bad argument #3 (expected table, got " .. type( _headers ) .. ")", 2 )
|
||||
end
|
||||
if _binary ~= nil and type( _binary ) ~= "boolean" then
|
||||
error( "bad argument #4 (expected boolean, got " .. type( _binary ) .. ")", 2 )
|
||||
end
|
||||
local ok, err = nativeHTTPRequest( _url, _post, _headers, _binary )
|
||||
if not ok then
|
||||
os.queueEvent( "http_failure", _url, err )
|
||||
|
||||
Reference in New Issue
Block a user