lune-packaging/tests/net/request/util.luau

24 lines
481 B
Lua
Raw Normal View History

2023-01-21 01:10:19 -05:00
local util = {}
2023-02-17 15:09:30 +01:00
function util.pass(method, url, message)
2023-01-21 01:10:19 -05:00
local response = net.request({
method = method,
url = url,
})
2023-02-17 15:09:30 +01:00
if not response.ok then
error(string.format("%s failed!\nResponse: %s", message, stdio.format(response)))
end
2023-01-21 01:10:19 -05:00
end
2023-02-17 15:09:30 +01:00
function util.fail(method, url, message)
2023-01-21 01:10:19 -05:00
local response = net.request({
method = method,
url = url,
})
2023-02-17 19:20:17 +01:00
if response.ok then
2023-02-17 15:09:30 +01:00
error(string.format("%s passed!\nResponse: %s", message, stdio.format(response)))
end
2023-01-21 01:10:19 -05:00
end
return util