unleash-server
Version:
Unleash is an enterprise ready feature toggles service. It provides different strategies for handling feature toggles.
34 lines • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStandardResponses = exports.emptyResponse = void 0;
exports.emptyResponse = {
description: 'This response has no body.',
};
const unauthorizedResponse = {
description: 'Authorization information is missing or invalid. Provide a valid API token as the `authorization` header, e.g. `authorization:*.*.my-admin-token`.',
};
const forbiddenResponse = {
description: 'User credentials are valid but does not have enough privileges to execute this operation',
};
const badRequestResponse = {
description: 'The request data does not match what we expect.',
};
const notFoundResponse = {
description: 'The requested resource was not found.',
};
const conflictResponse = {
description: 'The provided resource can not be created or updated because it would conflict with the current state of the resource or with an already existing resource, respectively.',
};
const standardResponses = {
400: badRequestResponse,
401: unauthorizedResponse,
403: forbiddenResponse,
404: notFoundResponse,
409: conflictResponse,
};
const getStandardResponses = (...statusCodes) => statusCodes.reduce((acc, statusCode) => ({
...acc,
[statusCode]: standardResponses[statusCode],
}), {});
exports.getStandardResponses = getStandardResponses;
//# sourceMappingURL=standard-responses.js.map