Moss · API

renderDocument

Draws a page for whoever the request’s session cookie names, and answers it with the headers it goes out with. Who the page was drawn for is the whole rule: no page declares its own cache policy. Example: with no cookie the page is drawn for nobody and goes out with Cache-Control: no-cache; with Grace’s it goes out with private, no-store, both with Vary: Cookie.

Calls
renderDocument({ server, template, request: { path: '/', cookie: '' }, draw })
renderDocument({ server, template, request: { path: '/', cookie: 'nisc.token=eyJzdWIiOiJncmFjZSJ9' }, draw })
Headers for nobody
{
  'cache-control': 'no-cache',
  'vary': 'Cookie',
}
Headers for grace
{
  'cache-control': 'private, no-store',
  'vary': 'Cookie',
}
Output matches the expected value

Computed when this site was built, by the installed package, which does not run in a browser. The site’s checks recompute it on every change.