Skip to content

Commit

Permalink
removed set-cookie-parser dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
manchenkoff committed Sep 22, 2023
1 parent 4c23c6f commit dc9baf1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 31 deletions.
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
},
"dependencies": {
"@nuxt/kit": "^3.7.3",
"@types/set-cookie-parser": "^2.4.3",
"defu": "^6.1.2",
"set-cookie-parser": "^2.6.0"
"defu": "^6.1.2"
},
"devDependencies": {
"@nuxt/devtools": "latest",
Expand All @@ -57,4 +55,4 @@
"vue": "^3.3.4"
},
"packageManager": "yarn@3.6.3"
}
}
12 changes: 3 additions & 9 deletions src/runtime/httpFactory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { $Fetch, FetchOptions } from 'ofetch';
import { appendHeader } from 'h3';
import cookieParser from 'set-cookie-parser';
import {
useCookie,
useRequestEvent,
Expand Down Expand Up @@ -91,18 +90,13 @@ export function createHttpClient(): $Fetch {
// pass all cookies from the API to the client on SSR response
if (process.server) {
const serverCookieName = 'set-cookie';
const rawCookiesHeader = response.headers.get(serverCookieName);
const cookie = response.headers.get(serverCookieName);

if (rawCookiesHeader === null) {
if (cookie === null) {
return;
}

const cookies =
cookieParser.splitCookiesString(rawCookiesHeader);

for (const cookie of cookies) {
appendHeader(event, serverCookieName, cookie);
}
appendHeader(event, serverCookieName, cookie);
}

// follow redirects on client
Expand Down
18 changes: 0 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1877,15 +1877,6 @@ __metadata:
languageName: node
linkType: hard

"@types/set-cookie-parser@npm:^2.4.3":
version: 2.4.3
resolution: "@types/set-cookie-parser@npm:2.4.3"
dependencies:
"@types/node": "*"
checksum: 8c0ded364c5a53598dc58f6c668d6fdbefa3bb78fcb1181202b92f4d8495ca33b4317f54ac0fe42824278e789d730ee5cbd2f7f864466e708589ff4eab2bf457
languageName: node
linkType: hard

"@typescript-eslint/eslint-plugin@npm:^6.5.0":
version: 6.7.2
resolution: "@typescript-eslint/eslint-plugin@npm:6.7.2"
Expand Down Expand Up @@ -6384,7 +6375,6 @@ __metadata:
"@nuxt/schema": ^3.7.3
"@nuxt/test-utils": ^3.7.3
"@types/node": ^18.17.17
"@types/set-cookie-parser": ^2.4.3
changelogen: ^0.5.5
defu: ^6.1.2
eslint: ^8.49.0
Expand All @@ -6393,7 +6383,6 @@ __metadata:
nuxi: ^3.9.0
nuxt: ^3.7.3
prettier: ^3.0.3
set-cookie-parser: ^2.6.0
vite: ^4.4.9
vitest: ^0.33.0
vue: ^3.3.4
Expand Down Expand Up @@ -7694,13 +7683,6 @@ __metadata:
languageName: node
linkType: hard

"set-cookie-parser@npm:^2.6.0":
version: 2.6.0
resolution: "set-cookie-parser@npm:2.6.0"
checksum: bf11ebc594c53d84588f1b4c04f1b8ce14e0498b1c011b3d76b5c6d5aac481bbc3f7c5260ec4ce99bdc1d9aed19f9fc315e73166a36ca74d0f12349a73f6bdc9
languageName: node
linkType: hard

"setprototypeof@npm:1.2.0":
version: 1.2.0
resolution: "setprototypeof@npm:1.2.0"
Expand Down

0 comments on commit dc9baf1

Please sign in to comment.