Expose agent on supertest and cookie methods on superagent

This commit is contained in:
John Purcell
2014-03-19 13:03:19 -04:00
parent 429cfd875e
commit ab5886b01f
3 changed files with 20 additions and 0 deletions
+16
View File
@@ -14,3 +14,19 @@ supertest(app)
.end((err, res) => {
if (err) throw err;
});
// cookie scenario
var request = supertest(app);
var agent = supertest.agent();
request
.post('/login')
.end((err, res) => {
if (err) throw err;
agent.saveCookies(res);
var req = request.get('/admin');
agent.attachCookies(req);
req.expect(200, (err, res) => {
if (err) throw err;
});
});