mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Merge pull request #5558 from ErisDS/remove-405
Removing incorrect 405 handling
This commit is contained in:
commit
fdd7354e6f
3 changed files with 0 additions and 19 deletions
|
@ -1,9 +1,5 @@
|
|||
var errors = require('../errors');
|
||||
|
||||
module.exports.methodNotAllowed = function methodNotAllowed(req, res, next) {
|
||||
next(new errors.MethodNotAllowedError('Unknown method: ' + req.path));
|
||||
};
|
||||
|
||||
module.exports.errorHandler = function errorHandler(err, req, res, next) {
|
||||
/*jshint unused:false */
|
||||
var httpErrors = errors.formatHttpErrors(err);
|
||||
|
|
|
@ -91,8 +91,6 @@ apiRoutes = function apiRoutes(middleware) {
|
|||
router.post('/uploads', middleware.busboy, api.http(api.uploads.add));
|
||||
|
||||
// API Router middleware
|
||||
router.use(middleware.api.methodNotAllowed);
|
||||
|
||||
router.use(middleware.api.errorHandler);
|
||||
|
||||
return router;
|
||||
|
|
|
@ -25,19 +25,6 @@ describe('Middleware: API Error Handlers', function () {
|
|||
sandbox.restore();
|
||||
});
|
||||
|
||||
describe('methodNotAllowed', function () {
|
||||
it('calls next with an error', function () {
|
||||
req.path = 'test';
|
||||
|
||||
middleware.api.methodNotAllowed(req, res, next);
|
||||
|
||||
next.calledOnce.should.be.true;
|
||||
next.firstCall.args[0].code.should.equal(405);
|
||||
next.firstCall.args[0].errorType.should.equal('MethodNotAllowedError');
|
||||
next.firstCall.args[0].message.should.match(/test$/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('errorHandler', function () {
|
||||
it('sends a JSON error response', function () {
|
||||
errors.logError = sandbox.spy(errors, 'logError');
|
||||
|
|
Loading…
Add table
Reference in a new issue