Skip to content
Myr

Added optional app.head() support

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 74a0177 · 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:+2 added−1 removed
  • other:+12 added−3 removed

2 files+14 added−4 removed

modified:lib/router/index.js+12 added-3 removed
329 unmodified lines
330 * @return {Route}331 * @api private332 */333334Router.prototype._match = function(req, i){334Router.prototype._match = function(req, i, head){335 var method = req.method.toLowerCase()336 , url = parse(req.url)337 , path = url.pathname338 , routes = this.map339 , captures340 , route341 , keys;342343 // pass HEAD to GET routes344 if ('head' == method) method = 'get';343 // HEAD support344 // TODO: clean this up345 if (!head && 'head' == method) {346 // attempt lookup347 route = this._match(req, i, true);348 if (route) return route;349350 // default to GET as res.render() / res.send()351 // etc support HEAD352 method = 'get';353 }354355 // routes for this method356 if (routes = routes[method]) {357358 // matching routes
55 unmodified lines
modified:test/app.head.js+2 added-1 removed