Lines Matching refs:cookie
57 throw new Error('Invalid cookie name')
63 cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
64 cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
96 throw new Error('Invalid cookie path')
112 throw new Error('Invalid cookie domain')
192 throw new Error('Invalid cookie max-age')
198 * @param {import('./index').Cookie} cookie
200 function stringify (cookie) {
201 if (cookie.name.length === 0) {
205 validateCookieName(cookie.name)
206 validateCookieValue(cookie.value)
208 const out = [`${cookie.name}=${cookie.value}`]
210 // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.1
211 // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.2
212 if (cookie.name.startsWith('__Secure-')) {
213 cookie.secure = true
216 if (cookie.name.startsWith('__Host-')) {
217 cookie.secure = true
218 cookie.domain = null
219 cookie.path = '/'
222 if (cookie.secure) {
226 if (cookie.httpOnly) {
230 if (typeof cookie.maxAge === 'number') {
231 validateCookieMaxAge(cookie.maxAge)
232 out.push(`Max-Age=${cookie.maxAge}`)
235 if (cookie.domain) {
236 validateCookieDomain(cookie.domain)
237 out.push(`Domain=${cookie.domain}`)
240 if (cookie.path) {
241 validateCookiePath(cookie.path)
242 out.push(`Path=${cookie.path}`)
245 if (cookie.expires && cookie.expires.toString() !== 'Invalid Date') {
246 out.push(`Expires=${toIMFDate(cookie.expires)}`)
249 if (cookie.sameSite) {
250 out.push(`SameSite=${cookie.sameSite}`)
253 for (const part of cookie.unparsed) {