#How to parse a specific cookie from request in loader

1 messages · Page 1 of 1 (latest)

rustic verge
#

Hello I'm sending a color-scheme cookie from my browser, and unable to parse the value of the cookie with remix. I can confirm that request.headers.get("Cookie") contains the cookie, but when I try to do cookie.parse() I am getting an empty object.

Note: Using Remix 1.16.1

export async function loader({ request }: LoaderArgs) {
  const colorSchemeCookie = createCookie("color-scheme");
  const colorScheme = await colorSchemeCookie.parse(request.headers.get("Cookie"));
  console.log(colorScheme); // an empty object -> {}
  return json({ colorScheme });
}
#

How to parse a specific cookie from request in loader

midnight hatch
#

How are you creating your cookie?

rustic verge
#

The cookie is created from the API (not developed with remix), with Set-Cookie header.