MCPcopy
hub / github.com/tinyhttp/tinyhttp / setCookie

Function setCookie

packages/session/src/index.ts:556–564  ·  view source on GitHub ↗
(res: ServerResponse, name: string, val: string, secret: string, options: SerializeOptions)

Source from the content-addressed store, hash-verified

554}
555
556function setCookie(res: ServerResponse, name: string, val: string, secret: string, options: SerializeOptions) {
557 const signed = 's:' + signature.sign(val, secret)
558 const data = cookie.serialize(name, signed, options)
559
560 const prev = (res.getHeader('Set-Cookie') as string[]) || []
561 const header = Array.isArray(prev) ? prev.concat(data) : [prev, data]
562
563 res.setHeader('Set-Cookie', header)
564}
565
566function getcookie(req: IncomingMessage, name: string, secrets: string[]) {
567 const header = req.headers.cookie

Callers 1

SessionManagerFunction · 0.70

Calls 1

serializeMethod · 0.80

Tested by

no test coverage detected