using 201 for created entities in etapi

This commit is contained in:
zadam
2022-01-12 21:14:12 +01:00
parent ce046b2e20
commit 2248d98cc7
10 changed files with 67 additions and 56 deletions

View File

@@ -12,8 +12,8 @@ function register(router) {
}
const {authToken} = etapiTokenService.createToken(tokenName || "ETAPI login");
res.json({
res.status(201).json({
authToken
});
});
@@ -26,18 +26,18 @@ function register(router) {
}
const etapiToken = becca.getEtapiToken(parsed.etapiTokenId);
if (!etapiToken) {
// shouldn't happen since this already passed auth validation
throw new Error(`Cannot find the token ${parsed.etapiTokenId}.`);
}
etapiToken.markAsDeletedSimple();
res.sendStatus(204);
});
}
module.exports = {
register
}
}