CARVIEW |
Select Language
HTTP/2 200
date: Thu, 31 Jul 2025 01:13:58 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"5eafdf6575b3ebb01faab96ef51e6b57"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com wss://alive-staging.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=WyI8GsY84uuvg3Zf5VPaoEHbR4VAIaz0Xp%2FimFAF5oZcUjoc3Rxls%2B%2F%2FxsFGSlLBEQLpRlPwWvbRBIDYtXDezfXE9HxUm76MJOcL60hTSLOjBwsJPffOJfmL54ARm9%2FCR%2Bi1u1qWnvoSZ8tcHA9Ty81EdiHe3VwmUsvlT79HebhBW%2F5QScT2AljN0G5Dn%2F8i9HK6EcOjvfoIa2fBc8BKPWP4IrZEddWmOKq0Rl1K9Gx9jFJ%2BKcIupeayK%2BRUO%2Bx18v2f7IIHNjWM5GRoWOMHWQ%3D%3D--JVQjrMhbuSeTeVho--CMNfi96dVYDllaJV1b4E6w%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.119410991.1753924437; Path=/; Domain=github.com; Expires=Fri, 31 Jul 2026 01:13:57 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Fri, 31 Jul 2026 01:13:57 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 97F2:1CD35:11CCA3:1B0E1E:688AC355
Release v4.0.0 · hoangvvo/next-session · GitHub
remove
Loading
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 26
v4.0.0
Compare
- ESM support, more lightweight
- More reliable due to removal of troublesome features like dual-getInitialProps/api support, callback/promise store dual support, etc.
- Add
session.touch()
note: v3 is continued to be maintained with bug fixes.
Breaking changes
session.isNew is removed
You can check the number of keys in session
to determined if it is new or set a custom property to your session
const isNew = Object.keys(req.session) > 1; // req.session only has the `cookie` property if new
// OR
req.session.isNotNew = true;
touchAfter
is now in seconds and not miliseconds
// BEFORE
const options = {
touchAfter: 7 * 24 * 60 * 60 * 1000, // 1 week
};
// AFTER
const options = {
touchAfter: 7 * 24 * 60 * 60, // 1 week
};
remove useSession
, applySession
, and withSession
in favor of a factory nextSession()
method
// BEFORE
import { withSession, applySession, session } from "next-session";
withSession(handler, options);
applySession(req, res, options);
app.use(session(options));
// AFTER
import nextSession from "next-session";
const getSession = nextSession(options);
The returned getSession
is almost the same with applySession
, only without the options
props. You can also re-implement withSession
and session
like below:
const getSession = nextSession(options);
function withSession(handler) {
return async function handlerWithSession(req, res) {
await getSession(req, res);
return handler(req, res);
};
}
async function session(req, res, next) {
try {
await getSession(req, res);
next();
} catch (err) {
next(err);
}
}
connect store requires promisification
In version v3.3.0
, we remove the need to use promisifyStore
with connect/express session store. After reconsideration on perf and reliability, this is added back.
Also, both promisifyStore
and expressSession
are moved to next-session/lib/compat
for better bundle size if not used.
// BEFORE
import { expressSession } from "next-session";
const RedisStore = require("connect-redis")(expressSession);
const options = {
store: new RedisStore(),
};
// AFTER
import { expressSession, promisifyStore } from "next-session/lib/compat";
const RedisStore = require("connect-redis")(expressSession);
const options = {
store: promisifyStore(new RedisStore()),
};
Assets 2
You can’t perform that action at this time.