@fastify/cookie
Advanced tools
Comparing version 9.0.4 to 9.1.0
{ | ||
"name": "@fastify/cookie", | ||
"version": "9.0.4", | ||
"version": "9.1.0", | ||
"description": "Plugin for fastify to add support for cookies", | ||
@@ -46,7 +46,7 @@ "main": "plugin.js", | ||
"fastify": "^4.0.0", | ||
"sinon": "^15.0.0", | ||
"sinon": "^16.0.0", | ||
"snazzy": "^9.0.0", | ||
"standard": "^17.0.0", | ||
"tap": "^16.0.0", | ||
"tsd": "^0.28.0" | ||
"tsd": "^0.29.0" | ||
}, | ||
@@ -53,0 +53,0 @@ "dependencies": { |
@@ -12,3 +12,3 @@ 'use strict' | ||
function fastifyCookieSetCookie (reply, name, value, options) { | ||
parseCookies(reply.context.server, reply.request, reply) | ||
parseCookies(reply.server, reply.request, reply) | ||
@@ -55,7 +55,5 @@ const opts = Object.assign({}, options) | ||
request.cookies = {} // New container per request. Issue #53 | ||
const cookieHeader = request.raw.headers.cookie | ||
if (cookieHeader) { | ||
request.cookies = fastify.parseCookie(cookieHeader) | ||
} | ||
request.cookies = cookieHeader ? fastify.parseCookie(cookieHeader) : {} // New container per request. Issue #53 | ||
reply[kReplySetCookies] = new Map() | ||
@@ -121,14 +119,2 @@ } | ||
function getHook (hook = 'onRequest') { | ||
const hooks = { | ||
onRequest: 'onRequest', | ||
preParsing: 'preParsing', | ||
preValidation: 'preValidation', | ||
preHandler: 'preHandler', | ||
[false]: false | ||
} | ||
return hooks[hook] | ||
} | ||
function plugin (fastify, options, next) { | ||
@@ -196,2 +182,14 @@ const secret = options.secret | ||
function getHook (hook = 'onRequest') { | ||
const hooks = { | ||
onRequest: 'onRequest', | ||
preParsing: 'preParsing', | ||
preValidation: 'preValidation', | ||
preHandler: 'preHandler', | ||
[false]: false | ||
} | ||
return hooks[hook] | ||
} | ||
function isConnectionSecure (request) { | ||
@@ -219,12 +217,6 @@ return ( | ||
*/ | ||
fastifyCookie.signerFactory = Signer | ||
fastifyCookie.fastifyCookie = fastifyCookie | ||
fastifyCookie.default = fastifyCookie | ||
module.exports = fastifyCookie | ||
module.exports.default = fastifyCookie // supersedes fastifyCookie.default = fastifyCookie | ||
module.exports.fastifyCookie = fastifyCookie // supersedes fastifyCookie.fastifyCookie = fastifyCookie | ||
fastifyCookie.fastifyCookie.signerFactory = Signer | ||
fastifyCookie.fastifyCookie.Signer = Signer | ||
fastifyCookie.fastifyCookie.sign = sign | ||
fastifyCookie.fastifyCookie.unsign = unsign | ||
module.exports.signerFactory = Signer | ||
@@ -231,0 +223,0 @@ module.exports.Signer = Signer |
@@ -9,3 +9,3 @@ 'use strict' | ||
const crypto = require('crypto') | ||
const crypto = require('node:crypto') | ||
@@ -12,0 +12,0 @@ const base64PaddingRE = /=/g |
'use strict' | ||
const tap = require('tap') | ||
const test = tap.test | ||
const { test } = require('tap') | ||
const Fastify = require('fastify') | ||
@@ -6,0 +5,0 @@ const sinon = require('sinon') |
@@ -5,3 +5,3 @@ 'use strict' | ||
const sinon = require('sinon') | ||
const crypto = require('crypto') | ||
const crypto = require('node:crypto') | ||
const { Signer, sign, unsign } = require('../signer') | ||
@@ -8,0 +8,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72544
1872