File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -466,13 +466,15 @@ Be very careful before proxying headers to an external API and just include head
466466 If you want to pass on/proxy cookies in the other direction, from an internal request back to the client, you will need to handle this yourself.
467467
468468``` ts [composables/fetch.ts]
469- import { appendResponseHeader , H3Event , splitCookiesString } from ' h3'
469+ import { appendResponseHeader } from ' h3'
470+ import type { H3Event } from ' h3'
471+ import { splitSetCookieString } from ' cookie-es'
470472
471473export const fetchWithCookie = async (event : H3Event , url : string ) => {
472474 /* Get the response from the server endpoint */
473475 const res = await $fetch .raw (url )
474476 /* Get the cookies from the response */
475- const cookies = splitCookiesString (res .headers .get (' set-cookie' ) || ' ' )
477+ const cookies = splitSetCookieString (res .headers .get (' set-cookie' ) || ' ' )
476478 /* Attach each cookie to our incoming Request */
477479 for (const cookie of cookies ) {
478480 appendResponseHeader (event , ' set-cookie' , cookie )
You can’t perform that action at this time.
0 commit comments