Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var Cookies = require("universal-cookie");
// we seem to sometimes get the ES6 version despite requesting cjs here, not sure why
// this isn't the ideal fix, but it'll do for now
Cookies = Cookies.default || Cookies;
function nextCookies(ctx, options) {
// Note: Next.js Static export sets ctx.req to a fake request with no headers
var header = ctx.req && ctx.req.headers && ctx.req.headers.cookie;
var uc = new Cookies(header);
return uc.getAll(options);
}
module.exports = nextCookies;