b15f1daf5a
closes #2757 - New error MethodNotAllowed - Throw 405 if valid path but invalid method is used is apiRouter - Adds api base tests
15 lines
409 B
JavaScript
15 lines
409 B
JavaScript
// # Not found error
|
|
// Custom error class with status code and type prefilled.
|
|
|
|
function MethodNotAllowedError(message) {
|
|
this.message = message;
|
|
this.stack = new Error().stack;
|
|
this.code = 405;
|
|
this.type = this.name;
|
|
}
|
|
|
|
MethodNotAllowedError.prototype = Object.create(Error.prototype);
|
|
MethodNotAllowedError.prototype.name = 'MethodNotAllowedError';
|
|
|
|
module.exports = MethodNotAllowedError;
|