Skip to content
Myr

refactor req.host

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 6654b71 · Browse files · 2 files+3 added−20 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+3 added−20 removed

  • tests:+0 added−18 removed
  • other:+3 added−2 removed

2 files+3 added−20 removed

modified:lib/request.js+3 added-2 removed
439 unmodified lines
440 */441442req.__defineGetter__('host', function(){443 var trustProxy = this.app.get('trust proxy');444 return (trustProxy && this.get('X-Forwarded-Host') || this.get('Host'))445 .split(':')[0];444 var host = trustProxy && this.get('X-Forwarded-Host');445 host = host || this.get('Host');446 return host.split(':')[0];447});448449/**450 * Check if the request is fresh, aka
46 unmodified lines
deleted:test/req.host.js-18 removed