Skip to content

Commit e54f5f7

Browse files
committed
Adding a test for default agent requests
1 parent bf38a51 commit e54f5f7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/request.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,19 @@ describe('request', function () {
175175
.then(done, done);
176176
});
177177

178+
it('agent can be used to set default headers', function (done){
179+
var agent = request.agent('https://httpbin.org');
180+
agent.auth("user", "passwd");
181+
182+
agent
183+
.get('/basic-auth/user/passwd')
184+
.then(function (res){
185+
res.should.have.status(200);
186+
agent.close();
187+
})
188+
.then(done, done);
189+
});
190+
178191
it('automatically closes the server down once done with it', function (done) {
179192
var server = require('http').createServer(function (req, res) {
180193
res.writeHeader(200, { 'content-type' : 'text/plain' });
@@ -240,6 +253,6 @@ describe('request', function () {
240253
res.body.cookies.biz.should.equal('baz');
241254
})
242255
.then(done, done);
243-
});
256+
});
244257
});
245258
});

0 commit comments

Comments
 (0)