Ghost/core/server/errors/method-not-allowed-error.js
Fabian Becker b15f1daf5a Throw 405 - Method not allowed for api routes
closes #2757
- New error MethodNotAllowed
- Throw 405 if valid path but invalid method is used is apiRouter
- Adds api base tests
2015-06-15 09:43:39 +01:00

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;