Skip to content

Commit

Permalink
qol(runtime): clarify message about unavailable headers (#10583)
Browse files Browse the repository at this point in the history
* qol(runtime): clarify message about unavailable headers

* update test assertion
  • Loading branch information
lilnasy authored Mar 27, 2024
1 parent 4abdb9d commit bd7effc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/astro/src/core/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/test/static-build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit bd7effc

Please sign in to comment.