Skip to content

Commit

Permalink
feat(utils/cookie): allow setting cookie SameSite attribute in lowerc…
Browse files Browse the repository at this point in the history
…ase too (#2668)
  • Loading branch information
BlankParticle authored May 14, 2024
1 parent e1257f1 commit e709821
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions deno_dist/utils/cookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type CookieOptions = {
path?: string
secure?: boolean
signingSecret?: string
sameSite?: 'Strict' | 'Lax' | 'None'
sameSite?: 'Strict' | 'Lax' | 'None' | 'strict' | 'lax' | 'none'
partitioned?: boolean
prefix?: CookiePrefixOptions
} & PartitionCookieConstraint
Expand Down Expand Up @@ -188,7 +188,7 @@ const _serialize = (name: string, value: string, opt: CookieOptions = {}): strin
}

if (opt.sameSite) {
cookie += `; SameSite=${opt.sameSite}`
cookie += `; SameSite=${opt.sameSite.charAt(0).toUpperCase() + opt.sameSite.slice(1)}`
}

if (opt.partitioned) {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/cookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type CookieOptions = {
path?: string
secure?: boolean
signingSecret?: string
sameSite?: 'Strict' | 'Lax' | 'None'
sameSite?: 'Strict' | 'Lax' | 'None' | 'strict' | 'lax' | 'none'
partitioned?: boolean
prefix?: CookiePrefixOptions
} & PartitionCookieConstraint
Expand Down Expand Up @@ -188,7 +188,7 @@ const _serialize = (name: string, value: string, opt: CookieOptions = {}): strin
}

if (opt.sameSite) {
cookie += `; SameSite=${opt.sameSite}`
cookie += `; SameSite=${opt.sameSite.charAt(0).toUpperCase() + opt.sameSite.slice(1)}`
}

if (opt.partitioned) {
Expand Down

0 comments on commit e709821

Please sign in to comment.