Fix type: use third param type for cookies.set options
This commit is contained in:
parent
b703561a7e
commit
da339a767b
2 changed files with 2 additions and 2 deletions
|
|
@ -81,7 +81,7 @@ export async function POST(request: Request) {
|
||||||
const rec = toPairs(raw)
|
const rec = toPairs(raw)
|
||||||
const name = String(rec.name)
|
const name = String(rec.name)
|
||||||
const value = String(rec.value)
|
const value = String(rec.value)
|
||||||
const options: Parameters<typeof response.cookies.set>[1] = {
|
const options: Parameters<typeof response.cookies.set>[2] = {
|
||||||
httpOnly: Boolean(rec["httponly"]) || /httponly/i.test(raw),
|
httpOnly: Boolean(rec["httponly"]) || /httponly/i.test(raw),
|
||||||
secure: /;\s*secure/i.test(raw),
|
secure: /;\s*secure/i.test(raw),
|
||||||
path: typeof rec["path"] === "string" ? (rec["path"] as string) : "/",
|
path: typeof rec["path"] === "string" ? (rec["path"] as string) : "/",
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ export async function GET(request: NextRequest) {
|
||||||
const rec = toPairs(raw)
|
const rec = toPairs(raw)
|
||||||
const name = String(rec.name)
|
const name = String(rec.name)
|
||||||
const value = String(rec.value)
|
const value = String(rec.value)
|
||||||
const options: Parameters<typeof response.cookies.set>[1] = {
|
const options: Parameters<typeof response.cookies.set>[2] = {
|
||||||
httpOnly: Boolean(rec["httponly"]) || /httponly/i.test(raw),
|
httpOnly: Boolean(rec["httponly"]) || /httponly/i.test(raw),
|
||||||
secure: /;\s*secure/i.test(raw),
|
secure: /;\s*secure/i.test(raw),
|
||||||
path: typeof rec["path"] === "string" ? (rec["path"] as string) : "/",
|
path: typeof rec["path"] === "string" ? (rec["path"] as string) : "/",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue