Skip to content

Commit bd7effc

Browse files
authored
qol(runtime): clarify message about unavailable headers (#10583)
* qol(runtime): clarify message about unavailable headers * update test assertion
1 parent 4abdb9d commit bd7effc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/astro/src/core/request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export function createRequest({
7070
get() {
7171
logger.warn(
7272
null,
73-
`\`Astro.request.headers\` is not available in "static" output mode. To enable header access: set \`output: "server"\` or \`output: "hybrid"\` in your config file.`
73+
`\`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.`
7474
);
7575
return _headers;
7676
},

packages/astro/test/static-build.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ describe('Static build', () => {
186186
it('warns when accessing headers', async () => {
187187
let found = false;
188188
for (const log of logs) {
189-
if (/`Astro\.request\.headers` is not available in "static" output mode/.test(log.message)) {
189+
if (/`Astro\.request\.headers` is unavailable in "static" output mode/.test(log.message)) {
190190
found = true;
191191
}
192192
}

0 commit comments

Comments
 (0)