Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(function(res) {
expect(res).to.have.status(HttpStatus.METHOD_NOT_ALLOWED);
});
});
.then(function(res) {
expect(res).to.have.status(HttpStatus.METHOD_NOT_ALLOWED);
});
});
.then(function(res) {
expect(res).to.have.status(HttpStatus.METHOD_NOT_ALLOWED);
});
});
status: HttpStatus.BAD_REQUEST,
code: "BAD_ARTICLE_UPDATEE",
message: "title, topicId, change_log and content are required"
},
NO_ACCESS: {
status: HttpStatus.FORBIDDEN,
code: "NO_ACCESS",
message: "You are not authorized to perform this action"
},
NOT_FOUND: {
status: HttpStatus.NOT_FOUND,
code: "NOT_FOUND",
message: "Resource was not found"
},
DELETE_DEFAULT_TOPIC: {
status: HttpStatus.METHOD_NOT_ALLOWED,
code: "DELETE_DEFAULT_TOPIC",
message: "Can not delete default topic!"
},
DELETE_DEFAULT_ADMIN: {
status: HttpStatus.METHOD_NOT_ALLOWED,
code: "DELETE_DEFAULT_ADMIN",
message: "Can not delete admin user!"
}
};
module.exports = {
SALT_ROUNDS,
ADMIN_ID,
TOKEN_EXPIRATION,
DEFAULT_CHANGELOG_MESSAGE,
ROLES,
export function methodNotAllowed(req, res) {
res.status(HttpStatus.METHOD_NOT_ALLOWED).json({
error: {
code: HttpStatus.METHOD_NOT_ALLOWED,
message: HttpStatus.getStatusText(HttpStatus.METHOD_NOT_ALLOWED)
}
});
}
const HttpStatus = require('http-status-codes');
const status = HttpStatus.METHOD_NOT_ALLOWED;
class MethodNotAllowed extends Error {
constructor() {
super(HttpStatus.getStatusText(status));
this.status = status;
}
}
module.exports = MethodNotAllowed;
export function methodNotAllowed(req, res) {
res.status(HttpStatus.METHOD_NOT_ALLOWED).json({
error: {
code: HttpStatus.METHOD_NOT_ALLOWED,
message: HttpStatus.getStatusText(HttpStatus.METHOD_NOT_ALLOWED)
}
});
}
export function methodNotAllowed(req, res) {
res.status(HttpStatus.METHOD_NOT_ALLOWED).json({
error: {
code: HttpStatus.METHOD_NOT_ALLOWED,
message: HttpStatus.getStatusText(HttpStatus.METHOD_NOT_ALLOWED)
}
});
}
status: HttpStatus.FORBIDDEN,
code: "NO_ACCESS",
message: "You are not authorized to perform this action"
},
NOT_FOUND: {
status: HttpStatus.NOT_FOUND,
code: "NOT_FOUND",
message: "Resource was not found"
},
DELETE_DEFAULT_TOPIC: {
status: HttpStatus.METHOD_NOT_ALLOWED,
code: "DELETE_DEFAULT_TOPIC",
message: "Can not delete default topic!"
},
DELETE_DEFAULT_ADMIN: {
status: HttpStatus.METHOD_NOT_ALLOWED,
code: "DELETE_DEFAULT_ADMIN",
message: "Can not delete admin user!"
}
};
module.exports = {
SALT_ROUNDS,
ADMIN_ID,
TOKEN_EXPIRATION,
DEFAULT_CHANGELOG_MESSAGE,
ROLES,
ARTICLE_HISTORY_TYPES,
ERRORS
};
export function methodNotAllowed(arg1: T | string | Wrapper, arg2?: string): T {
return answer(HTTP.METHOD_NOT_ALLOWED, arg1, arg2);
}