mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-08 09:38:45 +00:00
* chore: add prettier configuration Signed-off-by: Xe Iaso <me@xeiaso.net> * format: run prettier tree-wide Signed-off-by: Xe Iaso <me@xeiaso.net> * chore(prettier): ignore intentionally ungrammatical files Signed-off-by: Xe Iaso <me@xeiaso.net> * ci: add PR title lint rule Signed-off-by: Xe Iaso <me@xeiaso.net> * ci: add DCO check Signed-off-by: Xe Iaso <me@xeiaso.net> * chore: add commitlint and husky Signed-off-by: Xe Iaso <me@xeiaso.net> * chore: add CONTRIBUTING guidelines Signed-off-by: Xe Iaso <me@xeiaso.net> * chore: set SKIP_INTEGRATION in precommit tests Signed-off-by: Xe Iaso <me@xeiaso.net> * chore: update spelling Signed-off-by: Xe Iaso <me@xeiaso.net> * ci(dco): remove reopened trigger Signed-off-by: Xe Iaso <me@xeiaso.net> * chore: remove dead file Signed-off-by: Xe Iaso <me@xeiaso.net> * chore(prettier): don't format nginx includes Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <me@xeiaso.net>
34 lines
768 B
JavaScript
34 lines
768 B
JavaScript
async function testWithUserAgent(userAgent) {
|
|
const statusCode = await fetch(
|
|
"https://relayd.local.cetacean.club:3004/reqmeta",
|
|
{
|
|
headers: {
|
|
"User-Agent": userAgent,
|
|
},
|
|
},
|
|
).then((resp) => resp.status);
|
|
return statusCode;
|
|
}
|
|
|
|
const codes = {
|
|
allow: await testWithUserAgent("ALLOW"),
|
|
challenge: await testWithUserAgent("CHALLENGE"),
|
|
deny: await testWithUserAgent("DENY"),
|
|
};
|
|
|
|
const expected = {
|
|
allow: 200,
|
|
challenge: 401,
|
|
deny: 403,
|
|
};
|
|
|
|
console.log("ALLOW: ", codes.allow);
|
|
console.log("CHALLENGE:", codes.challenge);
|
|
console.log("DENY: ", codes.deny);
|
|
|
|
if (JSON.stringify(codes) !== JSON.stringify(expected)) {
|
|
throw new Error(
|
|
`wanted ${JSON.stringify(expected)}, got: ${JSON.stringify(codes)}`,
|
|
);
|
|
}
|