Skip to content
Myr

added options test

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 5b33788 · Browse files · 2 files+22 added−1 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+22 added−1 removed

  • tests:+21 added−0 removed
  • other:+1 added−1 removed

2 files+22 added−1 removed

modified:lib/router/index.js+1 added-1 removed
279 unmodified lines
280Router.prototype._optionsFor = function(path){281 var self = this;282 return methods.filter(function(method){283 var routes = self.routes[method];284 if (!routes) return;284 if (!routes || 'options' == method) return;285 for (var i = 0, len = routes.length; i < len; ++i) {286 if (routes[i].match(path)) return true;287 }288 }).map(function(method){
95 unmodified lines
modified:test/router.test.js+21 added
275 unmodified lines
276277 assert.response(app,278 { url: '/Account' },279 { body: 'Account' });280 },281 282 'override OPTIONS default': function(){283 var app = express.createServer();284285 app.get('/', function(req, res, next){286 287 });288289 app.options('/foo', function(req, res, next){290 res.header('Allow', 'GET')291 res.send('whatever');292 });293294 assert.response(app,295 { url: '/', method: 'OPTIONS' },296 { body: 'GET', headers: { Allow: 'GET' }});297298 assert.response(app,299 { url: '/foo', method: 'OPTIONS' },300 { body: 'whatever', headers: { Allow: 'GET' }});301 }302};