Skip to content
Myr

Added app.remove() for app.remove.all()

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

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent b9596d7 · Browse files · 2 files+14 added−4 removed
This commit

State

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

Diff stats

2 files+14 added−4 removed

  • tests:+10 added−3 removed
  • other:+4 added−1 removed

2 files+14 added−4 removed

modified:lib/http.js+4 added-1 removed
56 unmodified lines
57app.init = function(middleware){58 var self = this;59 this.cache = {};60 this.match = {};61 this.remove = {};61 this.lookup = {};62 this.settings = {};63 this.redirects = {};64 this.isCallbacks = {};
50 unmodified lines
115 // so that they disregard definition position.116 this.on('listening', this.registerErrorHandlers.bind(this));117118 // route lookup methods119 this.remove = function(url){120 return self.remove.all(url);121 };122123 methods.forEach(function(method){124 self.match[method] = function(url){125 return self.router.match(url, 'all' == method126 ? null
371 unmodified lines
modified:test/router.test.js+10 added-3 removed
189 unmodified lines
190 var app = express.createServer();191 app.get('/user', function(){});192 app.get('/user', function(){});193 app.put('/user', function(){});194 app.get('/user/:id', function(){});195 app.put('/user/:id', function(){});196 app.del('/user/:id', function(){});194195 app.get('/user').should.have.length(2);196 var removed = app.remove.get('/user');197 removed.should.have.length(2);
1 unmodified line
199 var removed = app.remove.get('/user');200 removed.should.have.length(0);201 app.get('/user').should.have.length(0);202203 app.get('/user/:id', function(){});204 app.put('/user/:id', function(){});205 app.del('/user/:id', function(){});206207 app.remove.all('/user/:id').should.have.length(3);208 app.remove.all('/user/:id').should.have.length(0);209 210 app.get('/user/:id', function(){});211 app.put('/user/:id', function(){});212 app.del('/user/:id', function(){});213214 app.remove('/user/:id').should.have.length(3);215 },216 217 'test app.match': function(){218 var app = express.createServer();
25 unmodified lines