From c3b083f286baee08b1aabbc95dfab111622b2f33 Mon Sep 17 00:00:00 2001 From: matthewp Date: Thu, 7 Apr 2022 19:17:47 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/core/request.ts | 11 ++++++----- packages/astro/src/vite-plugin-astro-server/index.ts | 2 +- packages/astro/test/static-build.test.js | 10 ++++++---- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/astro/src/core/request.ts b/packages/astro/src/core/request.ts index c18d4f2ca..9808a4e33 100644 --- a/packages/astro/src/core/request.ts +++ b/packages/astro/src/core/request.ts @@ -20,7 +20,7 @@ export function createRequest({ method = 'GET', body = undefined, logging, - ssr + ssr, }: CreateRequestOptions): Request { let headersObj = headers instanceof Headers @@ -52,20 +52,21 @@ export function createRequest({ }, }); - if(!ssr) { + if (!ssr) { // Warn when accessing headers in SSG mode const _headers = request.headers; const headersDesc = Object.getOwnPropertyDescriptor(request, 'headers') || {}; Object.defineProperty(request, 'headers', { ...headersDesc, get() { - warn(logging, + warn( + logging, 'ssg', `Headers are not exposed in static-site generation (SSG) mode. To enable reading headers you need to set an SSR adapter in your config.` ); return _headers; - } - }) + }, + }); } return request; diff --git a/packages/astro/src/vite-plugin-astro-server/index.ts b/packages/astro/src/vite-plugin-astro-server/index.ts index 1838a5ad4..e162b4cd1 100644 --- a/packages/astro/src/vite-plugin-astro-server/index.ts +++ b/packages/astro/src/vite-plugin-astro-server/index.ts @@ -176,7 +176,7 @@ async function handleRequest( method: req.method, body, logging, - ssr: buildingToSSR + ssr: buildingToSSR, }); try { diff --git a/packages/astro/test/static-build.test.js b/packages/astro/test/static-build.test.js index e56f40077..cc6436138 100644 --- a/packages/astro/test/static-build.test.js +++ b/packages/astro/test/static-build.test.js @@ -22,12 +22,11 @@ describe('Static build', () => { dest: { write(chunk) { logs.push(chunk); - } + }, }, level: 'warn', }; - fixture = await loadFixture({ root: './fixtures/static build/', }); @@ -158,8 +157,11 @@ describe('Static build', () => { it('warns when accessing headers', async () => { let found = false; - for(const log of logs) { - if(log.type === 'ssg' && /[hH]eaders are not exposed in static-site generation/.test(log.args[0])) { + for (const log of logs) { + if ( + log.type === 'ssg' && + /[hH]eaders are not exposed in static-site generation/.test(log.args[0]) + ) { found = true; } }