Skip to content
Myr

Merge branch 'master' of github.com:visionmedia/express

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 · parents f8a9cbe, 15f2e0c · Browse files · 5 files+33 added−8 removed
This commit

State

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

Diff stats

5 files+33 added−8 removed

  • tests:+18 added−1 removed
  • other:+15 added−7 removed

5 files+33 added−8 removed

modified:lib/router/index.js+5 added
9 unmodified lines
1011var Route = require('./route')12 , Collection = require('./collection')13 , utils = require('../utils')14 , debug = require('debug')('express:routes')15 , parse = require('url').parse;1617/**18 * Expose `Router` constructor.
181 unmodified lines
200Router.prototype._dispatch = function(req, res, next){201 var params = this.params202 , self = this;203204 debug('dispatching %s %s', req.method, req.url);205206 // route dispatch207 (function pass(i, err){208 var paramCallbacks209 , paramIndex = 0
15 unmodified lines
225 if (!route && 'OPTIONS' == req.method) return self._options(req, res);226227 // no route228 if (!route) return next(err);229 debug('matched %s %s', route.method, route.path);230231 // we have a route232 // start at param 0233 req.params = route.params;
173 unmodified lines
407 // ensure path was given408 if (!path) throw new Error('Router#' + method + '() requires a path');409410 // create the route411 debug('defined %s %s', method, path);412 var route = new Route(method, path, callbacks, {413 sensitive: this.caseSensitive414 , strict: this.strict415 });
6 unmodified lines
modified:lib/router/route.js+3 added-2 removed
modified:lib/application.js+4 added-2 removed
10 unmodified lines
11var connect = require('connect')12 , Router = require('./router')13 , methods = Router.methods.concat('del', 'all')14 , middleware = require('./middleware')15 , debug = require('debug')('express:application')16 , View = require('./view')17 , url = require('url')18 , utils = connect.utils19 , path = require('path')20 , http = require('http')21 , join = path.join21 , fs = require('fs')22 , qs = require('qs');22 , fs = require('fs');2324/**25 * Application prototype.26 */
44 unmodified lines
71 var self = this;7273 // default settings74 this.set('env', process.env.NODE_ENV || 'development');75 debug('booting in %s mode', this.get('env'));7677 // implicit middleware78 this.use(connect.query());79 this.use(middleware.init(this));
95 unmodified lines
175 });176 };177 }178179 debug('use %s %s', route, fn.name || 'unnamed');180 connect.proto.use.call(this, route, fn);181182 // mounted an app183 if (app) {
348 unmodified lines
modified:test/app.router.js+18 added-1 removed
11var express = require('../')2 , request = require('./support/http')3 , assert = require('assert');4
103 unmodified lines
108 .get('/user/10/edit')109 .expect('editing user 10', done);110 })111 })112 113 describe('when given an array', function(){114 it('should match all paths in the array', function(done){115 var app = express();116 117 app.get(['/one', '/two'], function(req, res){118 res.end('works');119 });120 121 request(app)122 .get('/one')123 .expect('works', function() {124 request(app)125 .get('/two')126 .expect('works', done);127 });128 })129 })130131 describe('case sensitivity', function(){132 it('should be disabled by default', function(done){133 var app = express();
393 unmodified lines
modified:package.json+3 added-3 removed