From c507875acea5e1807f9de7d0afab3f32274f3226 Mon Sep 17 00:00:00 2001 From: Luis Herasme Date: Thu, 9 Jan 2025 09:58:15 -0400 Subject: [PATCH 1/2] fix: include host in $current_url --- packages/api/src/context.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/api/src/context.ts b/packages/api/src/context.ts index 3e8109328..5f4398e72 100644 --- a/packages/api/src/context.ts +++ b/packages/api/src/context.ts @@ -118,12 +118,14 @@ export function createTRPCContext( ); } + let current_url = opts.req.url; let pathname: string | undefined; let query: string | undefined; if (opts.req.url) { const url = new URL(opts.req.url, env.BLOBSCAN_API_BASE_URL); pathname = url.pathname; + current_url = url.toString(); query = url.searchParams.toString(); } @@ -133,7 +135,7 @@ export function createTRPCContext( properties: { $ip: getIP(opts.req), scope, - $current_url: opts.req.url, + $current_url: current_url, network: env.NETWORK_NAME, pathname, query, From 322d1a871e09dde478b49c09f6b10138cf8bc5f5 Mon Sep 17 00:00:00 2001 From: Luis Herasme Date: Sun, 12 Jan 2025 21:43:32 -0400 Subject: [PATCH 2/2] fix: rename variable current_url to currentUrl for consistency --- packages/api/src/context.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/api/src/context.ts b/packages/api/src/context.ts index 5f4398e72..b144682dd 100644 --- a/packages/api/src/context.ts +++ b/packages/api/src/context.ts @@ -118,14 +118,14 @@ export function createTRPCContext( ); } - let current_url = opts.req.url; + let currentUrl = opts.req.url; let pathname: string | undefined; let query: string | undefined; if (opts.req.url) { const url = new URL(opts.req.url, env.BLOBSCAN_API_BASE_URL); pathname = url.pathname; - current_url = url.toString(); + currentUrl = url.toString(); query = url.searchParams.toString(); } @@ -135,7 +135,7 @@ export function createTRPCContext( properties: { $ip: getIP(opts.req), scope, - $current_url: current_url, + $current_url: currentUrl, network: env.NETWORK_NAME, pathname, query,