Skip to content

Commit

Permalink
fix: include host in $current_url (#679)
Browse files Browse the repository at this point in the history
* fix: include host in $current_url

* fix: rename variable current_url to currentUrl for consistency
  • Loading branch information
luis-herasme authored Jan 13, 2025
1 parent a0f594f commit 03a74e5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/api/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,14 @@ export function createTRPCContext(
);
}

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;
currentUrl = url.toString();
query = url.searchParams.toString();
}

Expand All @@ -133,7 +135,7 @@ export function createTRPCContext(
properties: {
$ip: getIP(opts.req),
scope,
$current_url: opts.req.url,
$current_url: currentUrl,
network: env.NETWORK_NAME,
pathname,
query,
Expand Down

0 comments on commit 03a74e5

Please sign in to comment.