We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 055daee commit 5de8cdcCopy full SHA for 5de8cdc
index.js
@@ -21,7 +21,7 @@ module.exports = function(req){
21
22
// credentials
23
auth = new Buffer(auth, 'base64').toString();
24
- auth = auth.match(/^([^:]+):(.+)$/);
+ auth = auth.match(/^([^:]+):(.*)$/);
25
if (!auth) return;
26
27
return { name: auth[1], pass: auth[2] };
test/index.js
@@ -37,4 +37,11 @@ describe('auth(req)', function(){
37
auth(req).should.eql({ name: 'foo', pass: 'bar' });
38
})
39
40
+
41
+ describe('with empty password', function(){
42
+ it('should return .user and .pass', function(){
43
+ var req = request('basic Zm9vOg==');
44
+ auth(req).should.eql({ name: 'foo', pass: ''});
45
+ })
46
47
0 commit comments