Skip to content

Instantly share code, notes, and snippets.

@darrenderidder
Created August 6, 2013 14:39
Show Gist options
  • Save darrenderidder/6165082 to your computer and use it in GitHub Desktop.
Save darrenderidder/6165082 to your computer and use it in GitHub Desktop.
it('should authenticate a user', function (done) {
var qstring = JSON.stringify({
userid: testuserParams.login,
password: testuserParams.password
});
var options = defaultPostOptions('/login', qstring);
var req = http.request(options, function (res) {
sessionCookie = res.headers['set-coookie'][0];
res.ond('data', function (d) {
var body = JSON.parse(d.toString('utf8'));
body.should.have.property('message').and.match(/logged in/);
accountId = body.account.id;
done();
});
});
req.write(qstring);
req.end();
});
@gregl83
Copy link

gregl83 commented Jan 17, 2016

sessionCookie = res.headers['set-coookie'][0];

Should be: set-cookie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment