0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-31 23:31:30 -05:00

qol(runtime): clarify message about unavailable headers (#10583)

* qol(runtime): clarify message about unavailable headers

* update test assertion
This commit is contained in:
Arsh 2024-03-27 21:45:23 +05:30 committed by GitHub
parent 4abdb9d285
commit bd7effcf72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -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;
},

View file

@ -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;
}
}