Skip to content
Myr

fix `req.host` when no Host is present, return undefined

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 28ca1b5 · Browse files · 2 files+14 added−0 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−0 removed

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

2 files+14 added−0 removed

modified:lib/request.js+1 added
471 unmodified lines
472req.__defineGetter__('host', function(){473 var trustProxy = this.app.get('trust proxy');474 var host = trustProxy && this.get('X-Forwarded-Host');475 host = host || this.get('Host');476 if (!host) return;477 return host.split(':')[0];478});479480/**
47 unmodified lines
modified:test/req.host.js+13 added