From f0275298bdef2698a575cdf9d3ce377e62a13693 Mon Sep 17 00:00:00 2001 From: matthewp Date: Tue, 29 Mar 2022 11:36:02 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/core/endpoint/index.ts | 3 +-- packages/astro/src/core/request.ts | 20 +++++++------------ .../src/vite-plugin-astro-server/index.ts | 6 +++--- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/packages/astro/src/core/endpoint/index.ts b/packages/astro/src/core/endpoint/index.ts index fb525066c..8f59faad6 100644 --- a/packages/astro/src/core/endpoint/index.ts +++ b/packages/astro/src/core/endpoint/index.ts @@ -3,8 +3,7 @@ import type { RenderOptions } from '../render/core'; import { renderEndpoint } from '../../runtime/server/index.js'; import { getParamsAndProps, GetParamsAndPropsError } from '../render/core.js'; -export type EndpointOptions = Pick; +export type EndpointOptions = Pick; type EndpointCallResult = | { diff --git a/packages/astro/src/core/request.ts b/packages/astro/src/core/request.ts index d0b711a9f..4b9766b5b 100644 --- a/packages/astro/src/core/request.ts +++ b/packages/astro/src/core/request.ts @@ -11,18 +11,12 @@ export interface CreateRequestOptions { logging: LogOptions; } -export function createRequest({ - url, - headers, - method = 'GET', - logging -}: CreateRequestOptions): Request { - let headersObj = headers instanceof Headers ? headers : - new Headers(Object.entries(headers as Record)); - +export function createRequest({ url, headers, method = 'GET', logging }: CreateRequestOptions): Request { + let headersObj = headers instanceof Headers ? headers : new Headers(Object.entries(headers as Record)); + const request = new Request(url.toString(), { method: method, - headers: headersObj + headers: headersObj, }); Object.defineProperties(request, { @@ -30,14 +24,14 @@ export function createRequest({ get() { warn(logging, 'deprecation', `Astro.request.canonicalURL has been moved to Astro.canonicalURL`); return undefined; - } + }, }, params: { get() { warn(logging, 'deprecation', `Astro.request.params has been moved to Astro.params`); return undefined; - } - } + }, + }, }); 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 66baf0d62..747765fec 100644 --- a/packages/astro/src/vite-plugin-astro-server/index.ts +++ b/packages/astro/src/vite-plugin-astro-server/index.ts @@ -121,9 +121,9 @@ async function handleRequest( const url = new URL(origin + req.url); const pathname = decodeURI(url.pathname); const rootRelativeUrl = pathname.substring(devRoot.length - 1); - if(!buildingToSSR) { + if (!buildingToSSR) { // Prevent user from depending on search params when not doing SSR. - for(const [key] of url.searchParams) { + for (const [key] of url.searchParams) { url.searchParams.delete(key); } } @@ -133,7 +133,7 @@ async function handleRequest( url, headers: buildingToSSR ? req.headers : new Headers(), method: req.method, - logging + logging, }); try {