mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 21:10:36 +00:00
26 lines
552 B
Lua
26 lines
552 B
Lua
local net = require("@lune/net")
|
|
local stdio = require("@lune/stdio")
|
|
|
|
local util = {}
|
|
|
|
function util.pass(method, url, message)
|
|
local response = net.request({
|
|
method = method,
|
|
url = url,
|
|
})
|
|
if not response.ok then
|
|
error(string.format("%s failed!\nResponse: %s", message, stdio.format(response)))
|
|
end
|
|
end
|
|
|
|
function util.fail(method, url, message)
|
|
local response = net.request({
|
|
method = method,
|
|
url = url,
|
|
})
|
|
if response.ok then
|
|
error(string.format("%s passed!\nResponse: %s", message, stdio.format(response)))
|
|
end
|
|
end
|
|
|
|
return util
|