mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
[ci] format
This commit is contained in:
parent
e556151603
commit
560a593418
4 changed files with 14 additions and 14 deletions
|
@ -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 = '';
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
|
|
|
@ -78,7 +78,7 @@ export default function (
|
|||
serverEntrypoint: '@my-ssr',
|
||||
exports: ['manifest', 'createApp'],
|
||||
supportedAstroFeatures: {
|
||||
serverOutput: "stable"
|
||||
serverOutput: 'stable',
|
||||
},
|
||||
...extendAdapter,
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue