1
0
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:
Wilma456
2017-08-21 15:20:32 +02:00
parent 579f7443a8
commit e9cea7d0f5
3 changed files with 48 additions and 9 deletions

View File

@@ -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 )