lune/tests/net/request/util.luau

24 lines
485 B
Lua
Raw Normal View History

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