diff --git a/src/content/docs/workers/examples/extract-cookie-value.mdx b/src/content/docs/workers/examples/extract-cookie-value.mdx index 26eeba1adfb..c79e9645e91 100644 --- a/src/content/docs/workers/examples/extract-cookie-value.mdx +++ b/src/content/docs/workers/examples/extract-cookie-value.mdx @@ -29,12 +29,12 @@ import { TabItem, Tabs } from "~/components"; ```js -import { parse } from "cookie"; +import { parseCookie } from "cookie"; export default { async fetch(request) { // The name of the cookie const COOKIE_NAME = "__uid"; - const cookie = parse(request.headers.get("Cookie") || ""); + const cookie = parseCookie(request.headers.get("Cookie") || ""); if (cookie[COOKIE_NAME] != null) { // Respond with the cookie value return new Response(cookie[COOKIE_NAME]); @@ -47,12 +47,12 @@ export default { ```ts -import { parse } from "cookie"; +import { parseCookie } from "cookie"; export default { async fetch(request): Promise { // The name of the cookie const COOKIE_NAME = "__uid"; - const cookie = parse(request.headers.get("Cookie") || ""); + const cookie = parseCookie(request.headers.get("Cookie") || ""); if (cookie[COOKIE_NAME] != null) { // Respond with the cookie value return new Response(cookie[COOKIE_NAME]);