Skip to content
Myr

add "Basic" check to req.auth

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 7bf4ad3 · Browse files · 2 files+19 added−2 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+19 added−2 removed

  • tests:+15 added−0 removed
  • other:+4 added−2 removed

2 files+19 added−2 removed

modified:lib/request.js+4 added-2 removed
385 unmodified lines
386 var auth = this.get('Authorization');387 if (!auth) return;388389 // malformed390 auth = auth.split(' ')[1];391 if (!auth) return;390 var parts = auth.split(' ');391 if ('basic' != parts[0].toLowerCase()) return;392 if (!parts[1]) return;393 auth = parts[1];394395 // credentials396 auth = new Buffer(auth, 'base64').toString().split(':');397 return { username: auth[0], password: auth[1] };
89 unmodified lines
modified:test/req.auth.js+15 added