Skip to content

Commit

Permalink
fix: initialize Map constructor properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed May 6, 2022
1 parent a08a468 commit a43832a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/next/server/web/spec-extension/cookies.ts
Expand Up @@ -37,8 +37,11 @@ const serializeCookie = (input: string[]) => input.join(', ')

export class Cookies extends Map<string, any> {
constructor(input?: string | null) {
super()
const parsedInput = typeof input === 'string' ? cookie.parse(input) : {}
super(Object.entries(parsedInput))
for (const [key, value] of Object.entries(parsedInput)) {
super.set(key, value)
}
}
set(key: string, value: unknown, options: CookieSerializeOptions = {}) {
return super.set(
Expand Down

0 comments on commit a43832a

Please sign in to comment.