diff --git a/packages/astro/src/container/index.ts b/packages/astro/src/container/index.ts index c762773d3b65..9ca9d23001e4 100644 --- a/packages/astro/src/container/index.ts +++ b/packages/astro/src/container/index.ts @@ -508,7 +508,7 @@ export class experimental_AstroContainer { pathname: url.pathname, locals: options?.locals ?? {}, partial: options?.partial ?? true, - clientAddress: '' + clientAddress: '', }); if (options.params) { renderContext.params = options.params; diff --git a/packages/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts index da5f917c1ffd..0e776ae9f2c6 100644 --- a/packages/astro/src/core/app/index.ts +++ b/packages/astro/src/core/app/index.ts @@ -241,7 +241,7 @@ export class App { let addCookieHeader: boolean | undefined; addCookieHeader = renderOptions?.addCookieHeader; - clientAddress = renderOptions?.clientAddress ?? Reflect.get(request,clientAddressSymbol); + clientAddress = renderOptions?.clientAddress ?? Reflect.get(request, clientAddressSymbol); routeData = renderOptions?.routeData; locals = renderOptions?.locals; @@ -286,7 +286,7 @@ export class App { request, routeData, status: defaultStatus, - clientAddress + clientAddress, }); response = await renderContext.render(await mod.page()); } catch (err: any) { @@ -305,7 +305,7 @@ export class App { // We don't have an error to report here. Passing null means we pass nothing intentionally // while undefined means there's no error error: response.status === 500 ? null : undefined, - clientAddress + clientAddress, }); } @@ -387,7 +387,7 @@ export class App { routeData: errorRouteData, status, props: { error }, - clientAddress + clientAddress, }); const response = await renderContext.render(await mod.page()); return this.#mergeResponses(response, originalResponse); @@ -399,7 +399,7 @@ export class App { status, response: originalResponse, skipMiddleware: true, - clientAddress + clientAddress, }); } } diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index 6fe6351cb6c0..47d6ef3def46 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -444,7 +444,7 @@ async function generatePath( pathname: pathname, request, routeData: route, - clientAddress: undefined + clientAddress: undefined, }); let body: string | Uint8Array; diff --git a/packages/astro/src/core/render-context.ts b/packages/astro/src/core/render-context.ts index 614777ac5fd6..86e39ee9a35a 100644 --- a/packages/astro/src/core/render-context.ts +++ b/packages/astro/src/core/render-context.ts @@ -525,11 +525,11 @@ export class RenderContext { getClientAddress() { const { pipeline, request, routeData, clientAddress } = this; - if(routeData.prerender) { + if (routeData.prerender) { throw new AstroError(AstroErrorData.PrerenderClientAddressNotAvailable); } - if(clientAddress) { + if (clientAddress) { return clientAddress; } diff --git a/packages/astro/src/vite-plugin-astro-server/route.ts b/packages/astro/src/vite-plugin-astro-server/route.ts index 3498571e8700..a3a5bc93cca3 100644 --- a/packages/astro/src/vite-plugin-astro-server/route.ts +++ b/packages/astro/src/vite-plugin-astro-server/route.ts @@ -190,7 +190,7 @@ export async function handleRoute({ middleware: isDefaultPrerendered404(matchedRoute.route) ? undefined : middleware, request, routeData: route, - clientAddress: incomingRequest.socket.remoteAddress + clientAddress: incomingRequest.socket.remoteAddress, }); let response; @@ -248,7 +248,7 @@ export async function handleRoute({ middleware: isDefaultPrerendered404(fourOhFourRoute.route) ? undefined : middleware, request, routeData: fourOhFourRoute.route, - clientAddress: incomingRequest.socket.remoteAddress + clientAddress: incomingRequest.socket.remoteAddress, }); response = await renderContext.render(fourOhFourRoute.preloadedComponent); }