swc/bundler/tests/.cache/deno/07549e322b5884b0b56710f621809fef08d1866e.ts
강동윤 f8aa0509ce
fix(bundler): Fix stack overflow (#2080)
swc_bundler:
 - Prevent infinite recursions. (#1963)
2021-08-15 02:37:31 +00:00

26 lines
643 B
TypeScript

// Loaded from https://deno.land/x/tinyhttp@0.1.18/extensions/res/cookie.ts
import { Req, Res } from '../../deps.ts'
import * as cookie from 'https://deno.land/std@0.101.0/http/cookie.ts'
export const setCookie = <Request extends Req = Req, Response extends Res = Res>(req: Request, res: Response) => (
name: string,
value: string,
options?: Omit<cookie.Cookie, 'value' | 'name'>
): Response => {
cookie.setCookie(req, {
value,
name,
...options
})
return res
}
export const clearCookie = <Response extends Res = Res>(res: Response) => (name: string): Response => {
cookie.deleteCookie(res, name)
return res
}