[{"data":1,"prerenderedAt":1580},["ShallowReactive",2],{"navigation":3,"\u002Fdocs\u002Fcore-concepts\u002Fcookies":184,"\u002Fdocs\u002Fcore-concepts\u002Fcookies-surround":1575},[4,21,90,166],{"title":5,"path":6,"stem":7,"children":8,"status":11,"icon":20},"Getting Started","\u002Fdocs\u002Fgetting-started","1.docs\u002F1.getting-started\u002F1.index",[9,12,16],{"title":10,"path":6,"stem":7,"status":11},"Introduction",null,{"title":13,"path":14,"stem":15,"status":11},"Installation","\u002Fdocs\u002Fgetting-started\u002Finstallation","1.docs\u002F1.getting-started\u002F2.installation",{"title":17,"path":18,"stem":19,"status":11},"Quick Start","\u002Fdocs\u002Fgetting-started\u002Fquick-start","1.docs\u002F1.getting-started\u002F3.quick-start",false,{"title":22,"path":23,"stem":24,"children":25,"status":11,"icon":20},"Core Concepts","\u002Fdocs\u002Fcore-concepts","1.docs\u002F2.core-concepts\u002F1.index",[26,28,32,36,40,50,54,58,62,66,70,74,78,82,86],{"title":27,"path":23,"stem":24,"status":11},"Overview",{"title":29,"path":30,"stem":31,"status":11},"Response","\u002Fdocs\u002Fcore-concepts\u002Fresponse","1.docs\u002F2.core-concepts\u002F10.response",{"title":33,"path":34,"stem":35,"status":11},"Cookies","\u002Fdocs\u002Fcore-concepts\u002Fcookies","1.docs\u002F2.core-concepts\u002F11.cookies",{"title":37,"path":38,"stem":39,"status":11},"Testing","\u002Fdocs\u002Fcore-concepts\u002Ftesting","1.docs\u002F2.core-concepts\u002F12.testing",{"title":41,"path":42,"stem":43,"children":44,"status":11,"icon":20,"defaultOpen":20},"Decorators","\u002Fdocs\u002Fcore-concepts\u002Fdecorators","1.docs\u002F2.core-concepts\u002F13.decorators\u002F1.index",[45,46],{"title":27,"path":42,"stem":43,"status":11},{"title":47,"path":48,"stem":49,"status":11},"Custom","\u002Fdocs\u002Fcore-concepts\u002Fdecorators\u002Fcustom","1.docs\u002F2.core-concepts\u002F13.decorators\u002F2.custom",{"title":51,"path":52,"stem":53,"status":11},"Discovery Service","\u002Fdocs\u002Fcore-concepts\u002Fdiscovery","1.docs\u002F2.core-concepts\u002F14.discovery",{"title":55,"path":56,"stem":57,"status":11},"Application Lifecycle","\u002Fdocs\u002Fcore-concepts\u002Fapp-lifecycle","1.docs\u002F2.core-concepts\u002F15.app-lifecycle",{"title":59,"path":60,"stem":61,"status":11},"Controllers","\u002Fdocs\u002Fcore-concepts\u002Fcontrollers","1.docs\u002F2.core-concepts\u002F2.controllers",{"title":63,"path":64,"stem":65,"status":11},"Routing","\u002Fdocs\u002Fcore-concepts\u002Frouting","1.docs\u002F2.core-concepts\u002F3.routing",{"title":67,"path":68,"stem":69,"status":11},"Providers","\u002Fdocs\u002Fcore-concepts\u002Fproviders","1.docs\u002F2.core-concepts\u002F4.providers",{"title":71,"path":72,"stem":73,"status":11},"Modules","\u002Fdocs\u002Fcore-concepts\u002Fmodules","1.docs\u002F2.core-concepts\u002F5.modules",{"title":75,"path":76,"stem":77,"status":11},"Configuration","\u002Fdocs\u002Fcore-concepts\u002Fconfiguration","1.docs\u002F2.core-concepts\u002F6.configuration",{"title":79,"path":80,"stem":81,"status":11},"Middleware","\u002Fdocs\u002Fcore-concepts\u002Fmiddleware","1.docs\u002F2.core-concepts\u002F7.middleware",{"title":83,"path":84,"stem":85,"status":11},"Guards","\u002Fdocs\u002Fcore-concepts\u002Fguards","1.docs\u002F2.core-concepts\u002F8.guards",{"title":87,"path":88,"stem":89,"status":11},"Exceptions","\u002Fdocs\u002Fcore-concepts\u002Fexceptions","1.docs\u002F2.core-concepts\u002F9.exceptions",{"title":91,"path":92,"stem":93,"children":94,"status":11,"icon":20},"Packages","\u002Fdocs\u002Fpackages","1.docs\u002F3.packages\u002F1.index",[95,96,101,112,116,120,138,142,146,150,154,158,162],{"title":27,"path":92,"stem":93,"status":11},{"title":97,"path":98,"stem":99,"status":100},"CLI","\u002Fdocs\u002Fpackages\u002Fcli","1.docs\u002F3.packages\u002F10.cli","experimental",{"title":102,"path":103,"stem":104,"children":105,"status":11,"icon":20,"defaultOpen":20},"Events","\u002Fdocs\u002Fpackages\u002Fmessaging","1.docs\u002F3.packages\u002F11.messaging\u002F1.index",[106,108],{"title":27,"path":103,"stem":104,"status":107},"beta",{"title":109,"path":110,"stem":111,"status":100},"Redis","\u002Fdocs\u002Fpackages\u002Fmessaging\u002Fredis","1.docs\u002F3.packages\u002F11.messaging\u002F2.redis",{"title":113,"path":114,"stem":115,"status":107},"Serve Static","\u002Fdocs\u002Fpackages\u002Fserve-static","1.docs\u002F3.packages\u002F12.serve-static",{"title":117,"path":118,"stem":119,"status":107},"Rate Limit","\u002Fdocs\u002Fpackages\u002Frate-limit","1.docs\u002F3.packages\u002F13.rate-limit",{"title":121,"path":122,"stem":123,"children":124,"status":11,"icon":20,"defaultOpen":20},"Auth","\u002Fdocs\u002Fpackages\u002Fauth","1.docs\u002F3.packages\u002F2.auth\u002F1.index",[125,126,130,134],{"title":27,"path":122,"stem":123,"status":107},{"title":127,"path":128,"stem":129,"status":107},"JWT Provider","\u002Fdocs\u002Fpackages\u002Fauth\u002Fjwt","1.docs\u002F3.packages\u002F2.auth\u002F2.jwt",{"title":131,"path":132,"stem":133,"status":107},"Local Provider","\u002Fdocs\u002Fpackages\u002Fauth\u002Flocal","1.docs\u002F3.packages\u002F2.auth\u002F3.local",{"title":135,"path":136,"stem":137,"status":100},"OAuth2 Provider","\u002Fdocs\u002Fpackages\u002Fauth\u002Foauth2","1.docs\u002F3.packages\u002F2.auth\u002F4.oauth2",{"title":139,"path":140,"stem":141,"status":107},"JWT","\u002Fdocs\u002Fpackages\u002Fjwt","1.docs\u002F3.packages\u002F3.jwt",{"title":143,"path":144,"stem":145,"status":107},"Drizzle","\u002Fdocs\u002Fpackages\u002Fdrizzle","1.docs\u002F3.packages\u002F4.drizzle",{"title":147,"path":148,"stem":149,"status":107},"Papr","\u002Fdocs\u002Fpackages\u002Fpapr","1.docs\u002F3.packages\u002F5.papr",{"title":151,"path":152,"stem":153,"status":107},"Mongoose","\u002Fdocs\u002Fpackages\u002Fmongoose","1.docs\u002F3.packages\u002F6.mongoose",{"title":155,"path":156,"stem":157,"status":107},"Swagger","\u002Fdocs\u002Fpackages\u002Fswagger","1.docs\u002F3.packages\u002F7.swagger",{"title":159,"path":160,"stem":161,"status":107},"Node Server","\u002Fdocs\u002Fpackages\u002Fnode-server","1.docs\u002F3.packages\u002F8.node-server",{"title":163,"path":164,"stem":165,"status":107},"uWS Server","\u002Fdocs\u002Fpackages\u002Fuws-server","1.docs\u002F3.packages\u002F9.uws-server",{"title":167,"path":168,"stem":169,"children":170,"status":11,"icon":20},"Roadmap","\u002Fdocs\u002Froadmap","1.docs\u002F4.roadmap\u002F1.index",[171,172,176,180],{"title":27,"path":168,"stem":169,"status":11},{"title":173,"path":174,"stem":175,"status":11},"Short term (0-3 months)","\u002Fdocs\u002Froadmap\u002Fshort-term","1.docs\u002F4.roadmap\u002F2.short-term",{"title":177,"path":178,"stem":179,"status":11},"Mid term (3-9 months)","\u002Fdocs\u002Froadmap\u002Fmid-term","1.docs\u002F4.roadmap\u002F3.mid-term",{"title":181,"path":182,"stem":183,"status":11},"Long term (9-12+ months)","\u002Fdocs\u002Froadmap\u002Flong-term","1.docs\u002F4.roadmap\u002F4.long-term",{"id":185,"title":33,"body":186,"description":1570,"extension":1571,"meta":1572,"navigation":1333,"path":34,"seo":1573,"status":11,"stem":35,"__hash__":1574},"docs\u002F1.docs\u002F2.core-concepts\u002F11.cookies.md",{"type":187,"value":188,"toc":1561},"minimark",[189,210,409,414,425,597,626,630,651,781,799,803,819,898,925,929,938,1155,1185,1196,1200,1206,1261,1266,1270,1297,1412,1416,1435,1448,1458,1557],[190,191,192,193,197,198,201,202,205,206,209],"p",{},"MiiaJS exposes cookies through two surfaces on the request context: ",[194,195,196],"code",{},"ctx.cookies",", a small jar for reading incoming cookies and writing response cookies, and ",[194,199,200],{},"ctx.res.cookie()"," \u002F ",[194,203,204],{},"ctx.res.deleteCookie()"," on the fluent ",[194,207,208],{},"ResponseBuilder",". Both write paths share the same serialization and validation.",[211,212,217],"pre",{"className":213,"code":214,"language":215,"meta":216,"style":216},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","@Get('\u002Fsession')\nsession(ctx: RequestContext) {\n  const current = ctx.cookies.get('sid')\n  ctx.cookies.set('sid', 'abc123', { httpOnly: true, sameSite: 'lax', maxAge: 3600 })\n  return { previous: current ?? null }\n}\n","typescript","",[194,218,219,248,260,299,378,403],{"__ignoreMap":216},[220,221,224,228,232,236,239,243,245],"span",{"class":222,"line":223},"line",1,[220,225,227],{"class":226},"sMK4o","@",[220,229,231],{"class":230},"s2Zo4","Get",[220,233,235],{"class":234},"sTEyZ","(",[220,237,238],{"class":226},"'",[220,240,242],{"class":241},"sfazB","\u002Fsession",[220,244,238],{"class":226},[220,246,247],{"class":234},")\n",[220,249,251,254,257],{"class":222,"line":250},2,[220,252,253],{"class":230},"session",[220,255,256],{"class":234},"(ctx: RequestContext) ",[220,258,259],{"class":226},"{\n",[220,261,263,267,270,273,276,279,282,284,287,290,292,295,297],{"class":222,"line":262},3,[220,264,266],{"class":265},"spNyl","  const",[220,268,269],{"class":234}," current",[220,271,272],{"class":226}," =",[220,274,275],{"class":234}," ctx",[220,277,278],{"class":226},".",[220,280,281],{"class":234},"cookies",[220,283,278],{"class":226},[220,285,286],{"class":230},"get",[220,288,235],{"class":289},"swJcz",[220,291,238],{"class":226},[220,293,294],{"class":241},"sid",[220,296,238],{"class":226},[220,298,247],{"class":289},[220,300,302,305,307,309,311,314,316,318,320,322,325,328,331,333,335,338,341,344,348,350,353,355,357,360,362,364,367,369,373,376],{"class":222,"line":301},4,[220,303,304],{"class":234},"  ctx",[220,306,278],{"class":226},[220,308,281],{"class":234},[220,310,278],{"class":226},[220,312,313],{"class":230},"set",[220,315,235],{"class":289},[220,317,238],{"class":226},[220,319,294],{"class":241},[220,321,238],{"class":226},[220,323,324],{"class":226},",",[220,326,327],{"class":226}," '",[220,329,330],{"class":241},"abc123",[220,332,238],{"class":226},[220,334,324],{"class":226},[220,336,337],{"class":226}," {",[220,339,340],{"class":289}," httpOnly",[220,342,343],{"class":226},":",[220,345,347],{"class":346},"sfNiH"," true",[220,349,324],{"class":226},[220,351,352],{"class":289}," sameSite",[220,354,343],{"class":226},[220,356,327],{"class":226},[220,358,359],{"class":241},"lax",[220,361,238],{"class":226},[220,363,324],{"class":226},[220,365,366],{"class":289}," maxAge",[220,368,343],{"class":226},[220,370,372],{"class":371},"sbssI"," 3600",[220,374,375],{"class":226}," }",[220,377,247],{"class":289},[220,379,381,385,387,390,392,394,397,400],{"class":222,"line":380},5,[220,382,384],{"class":383},"s7zQu","  return",[220,386,337],{"class":226},[220,388,389],{"class":289}," previous",[220,391,343],{"class":226},[220,393,269],{"class":234},[220,395,396],{"class":226}," ??",[220,398,399],{"class":226}," null",[220,401,402],{"class":226}," }\n",[220,404,406],{"class":222,"line":405},6,[220,407,408],{"class":226},"}\n",[410,411,413],"h2",{"id":412},"reading-cookies","Reading cookies",[190,415,416,417,420,421,424],{},"The jar parses the incoming ",[194,418,419],{},"Cookie"," header lazily on first access and caches the result for the rest of the request. Values are ",[194,422,423],{},"decodeURIComponent","-decoded (falling back to the raw value on malformed encoding), and surrounding double quotes are stripped. When a name appears more than once, the first occurrence wins.",[211,426,428],{"className":213,"code":427,"language":215,"meta":216,"style":216},"@Get('\u002Fwhoami')\nwhoami(ctx: RequestContext) {\n  const sid = ctx.cookies.get('sid')          \u002F\u002F string | undefined\n  const all = ctx.cookies.getAll()            \u002F\u002F Record\u003Cstring, string>\n  const loggedIn = ctx.cookies.has('sid')     \u002F\u002F boolean\n  return { sid, loggedIn, count: Object.keys(all).length }\n}\n",[194,429,430,447,456,490,516,550,592],{"__ignoreMap":216},[220,431,432,434,436,438,440,443,445],{"class":222,"line":223},[220,433,227],{"class":226},[220,435,231],{"class":230},[220,437,235],{"class":234},[220,439,238],{"class":226},[220,441,442],{"class":241},"\u002Fwhoami",[220,444,238],{"class":226},[220,446,247],{"class":234},[220,448,449,452,454],{"class":222,"line":250},[220,450,451],{"class":230},"whoami",[220,453,256],{"class":234},[220,455,259],{"class":226},[220,457,458,460,463,465,467,469,471,473,475,477,479,481,483,486],{"class":222,"line":262},[220,459,266],{"class":265},[220,461,462],{"class":234}," sid",[220,464,272],{"class":226},[220,466,275],{"class":234},[220,468,278],{"class":226},[220,470,281],{"class":234},[220,472,278],{"class":226},[220,474,286],{"class":230},[220,476,235],{"class":289},[220,478,238],{"class":226},[220,480,294],{"class":241},[220,482,238],{"class":226},[220,484,485],{"class":289},")          ",[220,487,489],{"class":488},"sHwdD","\u002F\u002F string | undefined\n",[220,491,492,494,497,499,501,503,505,507,510,513],{"class":222,"line":301},[220,493,266],{"class":265},[220,495,496],{"class":234}," all",[220,498,272],{"class":226},[220,500,275],{"class":234},[220,502,278],{"class":226},[220,504,281],{"class":234},[220,506,278],{"class":226},[220,508,509],{"class":230},"getAll",[220,511,512],{"class":289},"()            ",[220,514,515],{"class":488},"\u002F\u002F Record\u003Cstring, string>\n",[220,517,518,520,523,525,527,529,531,533,536,538,540,542,544,547],{"class":222,"line":380},[220,519,266],{"class":265},[220,521,522],{"class":234}," loggedIn",[220,524,272],{"class":226},[220,526,275],{"class":234},[220,528,278],{"class":226},[220,530,281],{"class":234},[220,532,278],{"class":226},[220,534,535],{"class":230},"has",[220,537,235],{"class":289},[220,539,238],{"class":226},[220,541,294],{"class":241},[220,543,238],{"class":226},[220,545,546],{"class":289},")     ",[220,548,549],{"class":488},"\u002F\u002F boolean\n",[220,551,552,554,556,558,560,562,564,567,569,572,574,577,579,582,585,587,590],{"class":222,"line":405},[220,553,384],{"class":383},[220,555,337],{"class":226},[220,557,462],{"class":234},[220,559,324],{"class":226},[220,561,522],{"class":234},[220,563,324],{"class":226},[220,565,566],{"class":289}," count",[220,568,343],{"class":226},[220,570,571],{"class":234}," Object",[220,573,278],{"class":226},[220,575,576],{"class":230},"keys",[220,578,235],{"class":289},[220,580,581],{"class":234},"all",[220,583,584],{"class":289},")",[220,586,278],{"class":226},[220,588,589],{"class":234},"length",[220,591,402],{"class":226},[220,593,595],{"class":222,"line":594},7,[220,596,408],{"class":226},[190,598,599,602,603,606,607,610,611,614,615,614,618,621,622,625],{},[194,600,601],{},"get()"," and ",[194,604,605],{},"has()"," read from an internal null-prototype cache, so cookie names that collide with ",[194,608,609],{},"Object.prototype"," members (",[194,612,613],{},"toString",", ",[194,616,617],{},"constructor",[194,619,620],{},"__proto__",") are treated as honest own properties rather than inherited ones. ",[194,623,624],{},"getAll()"," returns a snapshot copy as an ordinary plain object - mutating the returned object does not affect later reads from the jar.",[410,627,629],{"id":628},"setting-cookies","Setting cookies",[190,631,632,635,636,639,640,643,644,646,647,650],{},[194,633,634],{},"ctx.res.cookie(name, value, options?)"," appends a ",[194,637,638],{},"Set-Cookie"," header. It returns ",[194,641,642],{},"this",", so it chains with the rest of the ",[194,645,208],{}," API. ",[194,648,649],{},"ctx.cookies.set()"," is the equivalent shorthand and delegates to the same method.",[211,652,654],{"className":213,"code":653,"language":215,"meta":216,"style":216},"@Post('\u002Flogin')\nlogin(ctx: RequestContext) {\n  return ctx.res\n    .cookie('sid', 'abc123', { httpOnly: true, secure: true, sameSite: 'strict' })\n    .json({ ok: true })\n}\n",[194,655,656,674,683,694,754,777],{"__ignoreMap":216},[220,657,658,660,663,665,667,670,672],{"class":222,"line":223},[220,659,227],{"class":226},[220,661,662],{"class":230},"Post",[220,664,235],{"class":234},[220,666,238],{"class":226},[220,668,669],{"class":241},"\u002Flogin",[220,671,238],{"class":226},[220,673,247],{"class":234},[220,675,676,679,681],{"class":222,"line":250},[220,677,678],{"class":230},"login",[220,680,256],{"class":234},[220,682,259],{"class":226},[220,684,685,687,689,691],{"class":222,"line":262},[220,686,384],{"class":383},[220,688,275],{"class":234},[220,690,278],{"class":226},[220,692,693],{"class":234},"res\n",[220,695,696,699,702,704,706,708,710,712,714,716,718,720,722,724,726,728,730,733,735,737,739,741,743,745,748,750,752],{"class":222,"line":301},[220,697,698],{"class":226},"    .",[220,700,701],{"class":230},"cookie",[220,703,235],{"class":289},[220,705,238],{"class":226},[220,707,294],{"class":241},[220,709,238],{"class":226},[220,711,324],{"class":226},[220,713,327],{"class":226},[220,715,330],{"class":241},[220,717,238],{"class":226},[220,719,324],{"class":226},[220,721,337],{"class":226},[220,723,340],{"class":289},[220,725,343],{"class":226},[220,727,347],{"class":346},[220,729,324],{"class":226},[220,731,732],{"class":289}," secure",[220,734,343],{"class":226},[220,736,347],{"class":346},[220,738,324],{"class":226},[220,740,352],{"class":289},[220,742,343],{"class":226},[220,744,327],{"class":226},[220,746,747],{"class":241},"strict",[220,749,238],{"class":226},[220,751,375],{"class":226},[220,753,247],{"class":289},[220,755,756,758,761,763,766,769,771,773,775],{"class":222,"line":380},[220,757,698],{"class":226},[220,759,760],{"class":230},"json",[220,762,235],{"class":289},[220,764,765],{"class":226},"{",[220,767,768],{"class":289}," ok",[220,770,343],{"class":226},[220,772,347],{"class":346},[220,774,375],{"class":226},[220,776,247],{"class":289},[220,778,779],{"class":222,"line":405},[220,780,408],{"class":226},[190,782,783,784,786,787,790,791,794,795,798],{},"Multiple calls accumulate - each cookie becomes its own ",[194,785,638],{}," header rather than overwriting the previous one. The value is ",[194,788,789],{},"encodeURIComponent","-encoded automatically. ",[194,792,793],{},"path"," defaults to ",[194,796,797],{},"'\u002F'"," at this layer, so a cookie is visible across the whole site unless you narrow it.",[410,800,802],{"id":801},"deleting-cookies","Deleting cookies",[190,804,805,808,809,812,813,602,816,278],{},[194,806,807],{},"ctx.res.deleteCookie(name, { path?, domain? })"," (or ",[194,810,811],{},"ctx.cookies.delete()",") expires a cookie by emitting an epoch ",[194,814,815],{},"Expires",[194,817,818],{},"Max-Age=0",[211,820,822],{"className":213,"code":821,"language":215,"meta":216,"style":216},"@Post('\u002Flogout')\nlogout(ctx: RequestContext) {\n  return ctx.res.deleteCookie('sid').json({ ok: true })\n}\n",[194,823,824,841,850,894],{"__ignoreMap":216},[220,825,826,828,830,832,834,837,839],{"class":222,"line":223},[220,827,227],{"class":226},[220,829,662],{"class":230},[220,831,235],{"class":234},[220,833,238],{"class":226},[220,835,836],{"class":241},"\u002Flogout",[220,838,238],{"class":226},[220,840,247],{"class":234},[220,842,843,846,848],{"class":222,"line":250},[220,844,845],{"class":230},"logout",[220,847,256],{"class":234},[220,849,259],{"class":226},[220,851,852,854,856,858,861,863,866,868,870,872,874,876,878,880,882,884,886,888,890,892],{"class":222,"line":262},[220,853,384],{"class":383},[220,855,275],{"class":234},[220,857,278],{"class":226},[220,859,860],{"class":234},"res",[220,862,278],{"class":226},[220,864,865],{"class":230},"deleteCookie",[220,867,235],{"class":289},[220,869,238],{"class":226},[220,871,294],{"class":241},[220,873,238],{"class":226},[220,875,584],{"class":289},[220,877,278],{"class":226},[220,879,760],{"class":230},[220,881,235],{"class":289},[220,883,765],{"class":226},[220,885,768],{"class":289},[220,887,343],{"class":226},[220,889,347],{"class":346},[220,891,375],{"class":226},[220,893,247],{"class":289},[220,895,896],{"class":222,"line":301},[220,897,408],{"class":226},[899,900,901],"caution",{},[190,902,903,904,602,906,909,910,913,914,916,917,920,921,924],{},"A browser only removes a cookie when the deletion's ",[194,905,793],{},[194,907,908],{},"domain"," match the ones the cookie was set with. If you set a cookie with ",[194,911,912],{},"path: '\u002Fadmin'",", you must delete it with the same ",[194,915,793],{}," - ",[194,918,919],{},"deleteCookie('sid')"," alone (which uses ",[194,922,923],{},"path: '\u002F'",") will not clear it.",[410,926,928],{"id":927},"cookie-options","Cookie options",[190,930,931,934,935,937],{},[194,932,933],{},"CookieOptions"," covers the standard ",[194,936,638],{}," attributes:",[939,940,941,960],"table",{},[942,943,944],"thead",{},[945,946,947,951,954,957],"tr",{},[948,949,950],"th",{},"Option",[948,952,953],{},"Type",[948,955,956],{},"Default",[948,958,959],{},"Description",[961,962,963,984,1007,1027,1053,1076,1096,1115,1134],"tbody",{},[945,964,965,970,975,978],{},[966,967,968],"td",{},[194,969,908],{},[966,971,972],{},[194,973,974],{},"string",[966,976,977],{},"none",[966,979,980,983],{},[194,981,982],{},"Domain"," attribute. Validated against header-injection characters.",[945,985,986,990,994,1002],{},[966,987,988],{},[194,989,793],{},[966,991,992],{},[194,993,974],{},[966,995,996,998,999,584],{},[194,997,797],{}," (via ",[194,1000,1001],{},"cookie()",[966,1003,1004,983],{},[194,1005,1006],{},"Path",[945,1008,1009,1014,1019,1021],{},[966,1010,1011],{},[194,1012,1013],{},"expires",[966,1015,1016],{},[194,1017,1018],{},"Date",[966,1020,977],{},[966,1022,1023,1024,1026],{},"Absolute expiry. An invalid ",[194,1025,1018],{}," throws.",[945,1028,1029,1034,1039,1041],{},[966,1030,1031],{},[194,1032,1033],{},"maxAge",[966,1035,1036],{},[194,1037,1038],{},"number",[966,1040,977],{},[966,1042,1043,1044,1048,1049,1052],{},"Relative expiry in ",[1045,1046,1047],"strong",{},"seconds"," (unlike Express, which uses milliseconds). ",[194,1050,1051],{},"maxAge: 0"," is preserved.",[945,1054,1055,1060,1065,1070],{},[966,1056,1057],{},[194,1058,1059],{},"httpOnly",[966,1061,1062],{},[194,1063,1064],{},"boolean",[966,1066,1067],{},[194,1068,1069],{},"false",[966,1071,1072,1073,278],{},"Hides the cookie from ",[194,1074,1075],{},"document.cookie",[945,1077,1078,1083,1087,1090],{},[966,1079,1080],{},[194,1081,1082],{},"secure",[966,1084,1085],{},[194,1086,1064],{},[966,1088,1089],{},"see note",[966,1091,1092,1095],{},[194,1093,1094],{},"Secure"," attribute.",[945,1097,1098,1103,1108,1110],{},[966,1099,1100],{},[194,1101,1102],{},"sameSite",[966,1104,1105],{},[194,1106,1107],{},"'strict' | 'lax' | 'none'",[966,1109,977],{},[966,1111,1112,1095],{},[194,1113,1114],{},"SameSite",[945,1116,1117,1122,1127,1129],{},[966,1118,1119],{},[194,1120,1121],{},"priority",[966,1123,1124],{},[194,1125,1126],{},"'low' | 'medium' | 'high'",[966,1128,977],{},[966,1130,1131,1095],{},[194,1132,1133],{},"Priority",[945,1135,1136,1141,1145,1149],{},[966,1137,1138],{},[194,1139,1140],{},"partitioned",[966,1142,1143],{},[194,1144,1064],{},[966,1146,1147],{},[194,1148,1069],{},[966,1150,1151,1154],{},[194,1152,1153],{},"Partitioned"," attribute (CHIPS).",[1156,1157,1158],"note",{},[190,1159,1160,1163,1164,1166,1167,1170,1171,1173,1174,1177,1178,1180,1181,1184],{},[194,1161,1162],{},"sameSite: 'none'"," auto-enables ",[194,1165,1094],{},", because browsers reject a ",[194,1168,1169],{},"SameSite=None"," cookie that is not also ",[194,1172,1094],{}," (normative in RFC 6265bis). Passing ",[194,1175,1176],{},"secure: false"," together with ",[194,1179,1162],{}," throws a ",[194,1182,1183],{},"TypeError"," rather than emitting a cookie the browser would silently discard.",[190,1186,1187,1189,1190,1192,1193,1195],{},[194,1188,1121],{}," is a non-standard Chromium extension (from an expired 2016 IETF draft); other browsers ignore it. ",[194,1191,1140],{}," opts a cookie into CHIPS (Cookies Having Independent Partitioned State), shipped in Chrome, Firefox, and Safari, and requires ",[194,1194,1094],{}," - otherwise it throws.",[410,1197,1199],{"id":1198},"validation","Validation",[190,1201,1202,1203,1205],{},"Serialization is strict: instead of emitting a malformed or browser-rejected cookie, it throws a ",[194,1204,1183],{},". The conditions are:",[1207,1208,1209,1216,1228,1240,1247,1254],"ul",{},[1210,1211,1212,1215],"li",{},[194,1213,1214],{},"name"," is not a valid RFC 6265 token.",[1210,1217,1218,1220,1221,1223,1224,1227],{},[194,1219,793],{}," or ",[194,1222,908],{}," contains CR, LF, ",[194,1225,1226],{},";",", or control characters (header injection).",[1210,1229,1230,1232,1233,614,1236,1239],{},[194,1231,1033],{}," is not finite (",[194,1234,1235],{},"NaN",[194,1237,1238],{},"Infinity",").",[1210,1241,1242,1244,1245,278],{},[194,1243,1013],{}," is an invalid ",[194,1246,1018],{},[1210,1248,1249,1251,1252,278],{},[194,1250,1176],{}," is combined with ",[194,1253,1162],{},[1210,1255,1256,1258,1259,278],{},[194,1257,1140],{}," is set without a resolved ",[194,1260,1094],{},[1156,1262,1263],{},[190,1264,1265],{},"There is no size limit enforced - browsers guarantee at least 4096 bytes per cookie, and MiiaJS does not truncate. Keep session data small or store it server-side.",[410,1267,1269],{"id":1268},"low-level-primitives","Low-level primitives",[190,1271,1272,1273,1276,1277,1280,1281,1283,1284,1286,1287,1289,1290,1293,1294,278],{},"For custom scenarios, ",[194,1274,1275],{},"@miiajs\u002Fcore"," exports the serialization and parsing functions directly. ",[194,1278,1279],{},"serializeCookie(name, value, options?)"," returns a ",[194,1282,638],{}," string and, unlike ",[194,1285,200],{},", does not default ",[194,1288,793],{},". ",[194,1291,1292],{},"parseCookieHeader(header)"," returns a null-prototype ",[194,1295,1296],{},"Record\u003Cstring, string>",[211,1298,1300],{"className":213,"code":1299,"language":215,"meta":216,"style":216},"import { serializeCookie, parseCookieHeader } from '@miiajs\u002Fcore'\n\nconst header = serializeCookie('sid', 'abc123', { httpOnly: true, maxAge: 3600 })\nconst jar = parseCookieHeader('a=1; b=2')  \u002F\u002F { a: '1', b: '2' }, null prototype\n",[194,1301,1302,1329,1335,1386],{"__ignoreMap":216},[220,1303,1304,1307,1309,1312,1314,1317,1319,1322,1324,1326],{"class":222,"line":223},[220,1305,1306],{"class":383},"import",[220,1308,337],{"class":226},[220,1310,1311],{"class":234}," serializeCookie",[220,1313,324],{"class":226},[220,1315,1316],{"class":234}," parseCookieHeader",[220,1318,375],{"class":226},[220,1320,1321],{"class":383}," from",[220,1323,327],{"class":226},[220,1325,1275],{"class":241},[220,1327,1328],{"class":226},"'\n",[220,1330,1331],{"class":222,"line":250},[220,1332,1334],{"emptyLinePlaceholder":1333},true,"\n",[220,1336,1337,1340,1343,1346,1348,1350,1352,1354,1356,1358,1360,1362,1364,1366,1368,1370,1372,1374,1376,1378,1380,1382,1384],{"class":222,"line":262},[220,1338,1339],{"class":265},"const",[220,1341,1342],{"class":234}," header ",[220,1344,1345],{"class":226},"=",[220,1347,1311],{"class":230},[220,1349,235],{"class":234},[220,1351,238],{"class":226},[220,1353,294],{"class":241},[220,1355,238],{"class":226},[220,1357,324],{"class":226},[220,1359,327],{"class":226},[220,1361,330],{"class":241},[220,1363,238],{"class":226},[220,1365,324],{"class":226},[220,1367,337],{"class":226},[220,1369,340],{"class":289},[220,1371,343],{"class":226},[220,1373,347],{"class":346},[220,1375,324],{"class":226},[220,1377,366],{"class":289},[220,1379,343],{"class":226},[220,1381,372],{"class":371},[220,1383,375],{"class":226},[220,1385,247],{"class":234},[220,1387,1388,1390,1393,1395,1397,1399,1401,1404,1406,1409],{"class":222,"line":301},[220,1389,1339],{"class":265},[220,1391,1392],{"class":234}," jar ",[220,1394,1345],{"class":226},[220,1396,1316],{"class":230},[220,1398,235],{"class":234},[220,1400,238],{"class":226},[220,1402,1403],{"class":241},"a=1; b=2",[220,1405,238],{"class":226},[220,1407,1408],{"class":234},")  ",[220,1410,1411],{"class":488},"\u002F\u002F { a: '1', b: '2' }, null prototype\n",[410,1413,1415],{"id":1414},"integration-notes","Integration notes",[1417,1418,1419],"warning",{},[190,1420,1421,1422,1424,1425,1428,1429,1431,1432,1434],{},"Returning a raw ",[194,1423,29],{}," from a handler bypasses ",[194,1426,1427],{},"ctx.res"," entirely, so cookies you set through the jar or the builder are dropped. When you return a native ",[194,1430,29],{},", set ",[194,1433,638],{}," on that response directly.",[190,1436,1437,1438,1441,1442,1444,1445,1447],{},"A cookie you write during a request is not visible through ",[194,1439,1440],{},"ctx.cookies.get()"," in that same request - the jar only reflects the incoming ",[194,1443,419],{}," header, never your pending writes. Response cookies are marked on the ",[194,1446,208],{},", so they survive the optimized fast path and remain set even when a handler throws and the framework produces an error response.",[190,1449,1450,1451,1454,1455,1457],{},"In tests, read outgoing cookies with ",[194,1452,1453],{},"res.headers.getSetCookie()",", which returns an array of the individual ",[194,1456,638],{}," headers:",[211,1459,1461],{"className":213,"code":1460,"language":215,"meta":216,"style":216},"const res = await app.request('POST', '\u002Flogin')\nconst cookies = res.headers.getSetCookie()\nexpect(cookies[0]).toContain('sid=abc123')\n",[194,1462,1463,1502,1527],{"__ignoreMap":216},[220,1464,1465,1467,1470,1472,1475,1478,1480,1483,1485,1487,1490,1492,1494,1496,1498,1500],{"class":222,"line":223},[220,1466,1339],{"class":265},[220,1468,1469],{"class":234}," res ",[220,1471,1345],{"class":226},[220,1473,1474],{"class":383}," await",[220,1476,1477],{"class":234}," app",[220,1479,278],{"class":226},[220,1481,1482],{"class":230},"request",[220,1484,235],{"class":234},[220,1486,238],{"class":226},[220,1488,1489],{"class":241},"POST",[220,1491,238],{"class":226},[220,1493,324],{"class":226},[220,1495,327],{"class":226},[220,1497,669],{"class":241},[220,1499,238],{"class":226},[220,1501,247],{"class":234},[220,1503,1504,1506,1509,1511,1514,1516,1519,1521,1524],{"class":222,"line":250},[220,1505,1339],{"class":265},[220,1507,1508],{"class":234}," cookies ",[220,1510,1345],{"class":226},[220,1512,1513],{"class":234}," res",[220,1515,278],{"class":226},[220,1517,1518],{"class":234},"headers",[220,1520,278],{"class":226},[220,1522,1523],{"class":230},"getSetCookie",[220,1525,1526],{"class":234},"()\n",[220,1528,1529,1532,1535,1538,1541,1543,1546,1548,1550,1553,1555],{"class":222,"line":262},[220,1530,1531],{"class":230},"expect",[220,1533,1534],{"class":234},"(cookies[",[220,1536,1537],{"class":371},"0",[220,1539,1540],{"class":234},"])",[220,1542,278],{"class":226},[220,1544,1545],{"class":230},"toContain",[220,1547,235],{"class":234},[220,1549,238],{"class":226},[220,1551,1552],{"class":241},"sid=abc123",[220,1554,238],{"class":226},[220,1556,247],{"class":234},[1558,1559,1560],"style",{},"html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}",{"title":216,"searchDepth":250,"depth":250,"links":1562},[1563,1564,1565,1566,1567,1568,1569],{"id":412,"depth":250,"text":413},{"id":628,"depth":250,"text":629},{"id":801,"depth":250,"text":802},{"id":927,"depth":250,"text":928},{"id":1198,"depth":250,"text":1199},{"id":1268,"depth":250,"text":1269},{"id":1414,"depth":250,"text":1415},"Read incoming cookies and set response cookies with the ctx.cookies jar.","md",{},{"title":33,"description":1570},"dePGXQCnjLFzKvTrhRf9Gn_Bwy3vj5THJZS7hfiH-nM",[1576,1578],{"title":29,"path":30,"stem":31,"description":1577,"children":-1},"Build HTTP responses with the fluent ResponseBuilder API.",{"title":37,"path":38,"stem":39,"description":1579,"children":-1},"Test your application with the built-in TestApp utility.",1784659930973]