summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Arsh <lilnasy@users.noreply.github.com> 2024-02-29 18:39:09 +0000
committerGravatar astrobot-houston <fred+astrobot@astro.build> 2024-02-29 18:39:09 +0000
commit560a5934186bc57e1975e7d8830e6f29b18c7929 (patch)
tree2ef0908789397a8ec747748bd6b0190f5163d1ca
parente556151603a2f0173059d0f98fdcbec0610b48ff (diff)
downloadastro-560a5934186bc57e1975e7d8830e6f29b18c7929.tar.gz
astro-560a5934186bc57e1975e7d8830e6f29b18c7929.tar.zst
astro-560a5934186bc57e1975e7d8830e6f29b18c7929.zip
[ci] format
-rw-r--r--packages/astro/src/core/request.ts14
-rw-r--r--packages/astro/src/vite-plugin-astro-server/route.ts4
-rw-r--r--packages/astro/test/core-image.test.js8
-rw-r--r--packages/astro/test/test-adapter.js2
4 files changed, 14 insertions, 14 deletions
diff --git a/packages/astro/src/core/request.ts b/packages/astro/src/core/request.ts
index 13b9de4a5..85e3f5fb3 100644
--- a/packages/astro/src/core/request.ts
+++ b/packages/astro/src/core/request.ts
@@ -16,9 +16,9 @@ export interface CreateRequestOptions {
locals?: object | undefined;
/**
* Whether the request is being created for a static build or for a prerendered page within a hybrid/SSR build, or for emulating one of those in dev mode.
- *
+ *
* When `true`, the request will not include search parameters or body, and warn when headers are accessed.
- *
+ *
* @default false
*/
staticLike?: boolean;
@@ -36,19 +36,19 @@ export function createRequest({
body = undefined,
logger,
locals,
- staticLike = false
+ staticLike = false,
}: CreateRequestOptions): Request {
// headers are made available on the created request only if the request is for a page that will be on-demand rendered
- const headersObj =
- staticLike ? undefined :
- headers instanceof Headers
+ const headersObj = staticLike
+ ? undefined
+ : headers instanceof Headers
? headers
: new Headers(Object.entries(headers as Record<string, any>));
if (typeof url === 'string') url = new URL(url);
const imageEndpoint = prependForwardSlash(appendForwardSlash(base)) + '_image';
-
+
// HACK! astro:assets uses query params for the injected route in `dev`
if (staticLike && url.pathname !== imageEndpoint) {
url.search = '';
diff --git a/packages/astro/src/vite-plugin-astro-server/route.ts b/packages/astro/src/vite-plugin-astro-server/route.ts
index 8a737c2af..19af22ff6 100644
--- a/packages/astro/src/vite-plugin-astro-server/route.ts
+++ b/packages/astro/src/vite-plugin-astro-server/route.ts
@@ -185,7 +185,7 @@ export async function handleRoute({
headers: incomingRequest.headers,
logger,
// no route found, so we assume the default for rendering the 404 page
- staticLike: config.output === "static" || config.output === "hybrid",
+ staticLike: config.output === 'static' || config.output === 'hybrid',
});
route = {
component: '',
@@ -227,7 +227,7 @@ export async function handleRoute({
body,
logger,
clientAddress: incomingRequest.socket.remoteAddress,
- staticLike: config.output === "static" || route.prerender,
+ staticLike: config.output === 'static' || route.prerender,
});
// Set user specified headers to response object.
diff --git a/packages/astro/test/core-image.test.js b/packages/astro/test/core-image.test.js
index 3b240e606..590e77000 100644
--- a/packages/astro/test/core-image.test.js
+++ b/packages/astro/test/core-image.test.js
@@ -1061,10 +1061,10 @@ describe('astro:image', () => {
});
it('serves the image at /_image', async () => {
- const params = new URLSearchParams;
- params.set("href", "/src/assets/penguin1.jpg?origWidth=207&origHeight=243&origFormat=jpg");
- params.set("f", "webp");
- const response = await fixture.fetch("/some-base/_image?" + String(params));
+ const params = new URLSearchParams();
+ params.set('href', '/src/assets/penguin1.jpg?origWidth=207&origHeight=243&origFormat=jpg');
+ params.set('f', 'webp');
+ const response = await fixture.fetch('/some-base/_image?' + String(params));
assert.equal(response.status, 200);
assert.equal(response.headers.get('content-type'), 'image/webp');
});
diff --git a/packages/astro/test/test-adapter.js b/packages/astro/test/test-adapter.js
index ba8e7a0c8..72c5e0c0f 100644
--- a/packages/astro/test/test-adapter.js
+++ b/packages/astro/test/test-adapter.js
@@ -78,7 +78,7 @@ export default function (
serverEntrypoint: '@my-ssr',
exports: ['manifest', 'createApp'],
supportedAstroFeatures: {
- serverOutput: "stable"
+ serverOutput: 'stable',
},
...extendAdapter,
});