Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
supertest-session
Advanced tools
Session wrapper around supertest.
References:
$ npm test
Require supertest-session
and pass in the test application:
var Session = require('supertest-session')({
app: require('../../path/to/app')
});
Set up a session:
before(function () {
this.sess = new Session();
});
after(function () {
this.sess.destroy();
});
And set some expectations:
it('should fail accessing a restricted page', function (done) {
this.sess.get('/restricted')
.expect(401)
.end(done)
});
it('should sign in', function (done) {
this.sess.post('/signin')
.send({ username: 'foo', password: 'password' })
.expect(200)
.end(done);
});
it('should get a restricted page', function (done) {
this.sess.get('/restricted')
.expect(200)
.end(done)
});
The cookies attached to the session may be retrieved from session.cookies
at any time, for instance to inspect the contents of the current session in an external store.
it('should set session details correctly', function (done) {
var sessionCookie = _.find(sess.cookies, function (cookie) {
return _.has(cookie, 'connect.sid');
});
memcached.get(sessionCookie['connect.sid'], function (err, session) {
session.user.name.should.eq('Foobar');
done();
});
});
MIT
FAQs
Cookie-based session persistence for Supertest
The npm package supertest-session receives a total of 15,645 weekly downloads. As such, supertest-session popularity was classified as popular.
We found that supertest-session demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.