diff options
author | 2024-03-27 21:45:23 +0530 | |
---|---|---|
committer | 2024-03-27 21:45:23 +0530 | |
commit | bd7effcf720c2a79d130c72b323377f33fb7afe8 (patch) | |
tree | 9548357518492885ee789cad22df159131f48453 | |
parent | 4abdb9d2855aa095c45bb8144a1541bc94bd7e96 (diff) | |
download | astro-bd7effcf720c2a79d130c72b323377f33fb7afe8.tar.gz astro-bd7effcf720c2a79d130c72b323377f33fb7afe8.tar.zst astro-bd7effcf720c2a79d130c72b323377f33fb7afe8.zip |
qol(runtime): clarify message about unavailable headers (#10583)
* qol(runtime): clarify message about unavailable headers
* update test assertion
-rw-r--r-- | packages/astro/src/core/request.ts | 2 | ||||
-rw-r--r-- | packages/astro/test/static-build.test.js | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/packages/astro/src/core/request.ts b/packages/astro/src/core/request.ts index 85e3f5fb3..2e77a89c1 100644 --- a/packages/astro/src/core/request.ts +++ b/packages/astro/src/core/request.ts @@ -70,7 +70,7 @@ export function createRequest({ get() { logger.warn( null, - `\`Astro.request.headers\` is not available in "static" output mode. To enable header access: set \`output: "server"\` or \`output: "hybrid"\` in your config file.` + `\`Astro.request.headers\` is unavailable in "static" output mode, and in prerendered pages within "hybrid" and "server" output modes. If you need access to request headers, make sure that \`output\` is configured as either \`"server"\` or \`output: "hybrid"\` in your config file, and that the page accessing the headers is rendered on-demand.` ); return _headers; }, diff --git a/packages/astro/test/static-build.test.js b/packages/astro/test/static-build.test.js index 126e10116..5fc16ca0a 100644 --- a/packages/astro/test/static-build.test.js +++ b/packages/astro/test/static-build.test.js @@ -186,7 +186,7 @@ describe('Static build', () => { it('warns when accessing headers', async () => { let found = false; for (const log of logs) { - if (/`Astro\.request\.headers` is not available in "static" output mode/.test(log.message)) { + if (/`Astro\.request\.headers` is unavailable in "static" output mode/.test(log.message)) { found = true; } } |