Honour cookie domain on empty values
This commit is contained in:
parent
299e77bbed
commit
e8b35e2a68
|
@ -67,24 +67,22 @@ exports.getCookie = (ctx, name) => {
|
||||||
* @param {string|object} value The value of cookie which will be set.
|
* @param {string|object} value The value of cookie which will be set.
|
||||||
*/
|
*/
|
||||||
exports.setCookie = (ctx, value, name = "builder") => {
|
exports.setCookie = (ctx, value, name = "builder") => {
|
||||||
if (!value) {
|
if (value) {
|
||||||
ctx.cookies.set(name)
|
|
||||||
} else {
|
|
||||||
value = jwt.sign(value, options.secretOrKey)
|
value = jwt.sign(value, options.secretOrKey)
|
||||||
|
|
||||||
const config = {
|
|
||||||
maxAge: Number.MAX_SAFE_INTEGER,
|
|
||||||
path: "/",
|
|
||||||
httpOnly: false,
|
|
||||||
overwrite: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
if (environment.COOKIE_DOMAIN) {
|
|
||||||
config.domain = environment.COOKIE_DOMAIN
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.cookies.set(name, value, config)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
maxAge: Number.MAX_SAFE_INTEGER,
|
||||||
|
path: "/",
|
||||||
|
httpOnly: false,
|
||||||
|
overwrite: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (environment.COOKIE_DOMAIN) {
|
||||||
|
config.domain = environment.COOKIE_DOMAIN
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.cookies.set(name, value, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue