Skip to content
Myr

Fix handling when route.all is only route

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent b89a597 · Browse files · 3 files+35 added−31 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+35 added−31 removed

  • tests:+26 added−0 removed
  • other:+9 added−31 removed

3 files+35 added−31 removed

modified:lib/router/route.js+8 added-31 removed
modified:test/Route.js+26 added
12var should = require('should');3var express = require('../')4 , Route = express.Route5 , methods = require('methods')6 , assert = require('assert');
177 unmodified lines
184 assert.equal(err.message, 'oops');185 done();186 });187188 route.dispatch({ url: '/', method: 'GET' }, {});189 });190191 it('should handle throw in .all', function(done) {192 var route = new Route('');193194 route.all(function(req, res, next){195 throw new Error('boom!');196 });197198 route.dispatch({ url: '/', method: 'GET' }, {}, function(err){199 should(err).be.ok;200 err.message.should.equal('boom!');201 done();202 });203 });204205 it('should handle single error handler', function(done) {206 var route = new Route('');207208 route.all(function(err, req, res, next){209 // this should not execute210 true.should.be.false;211 });212213 route.dispatch({ url: '/', method: 'GET' }, {}, done);214 });215 })216})
modified:History.md+1 added
1 unmodified line
2==========34 * deprecate things with `depd` module5 * fix behavior when handling request without routes6 * fix handling when `route.all` is only route7 * restore `req.params` after invoking router8 * use `finalhandler` for final response handling9 * use `media-typer` to alter content-type charset10
1680 unmodified lines