Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
lilnasy authored and astrobot-houston committed Feb 29, 2024
1 parent e556151 commit 560a593
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions packages/astro/src/core/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 = '';
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/vite-plugin-astro-server/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
Expand Down Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions packages/astro/test/core-image.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/test/test-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function (
serverEntrypoint: '@my-ssr',
exports: ['manifest', 'createApp'],
supportedAstroFeatures: {
serverOutput: "stable"
serverOutput: 'stable',
},
...extendAdapter,
});
Expand Down

0 comments on commit 560a593

Please sign in to comment.