From fba01251094c4aa28fcc9e219987a3ed7103b5df Mon Sep 17 00:00:00 2001 From: anishdwivedi-spraxa Date: Fri, 12 Jun 2026 12:43:15 +0530 Subject: [PATCH] dev/anish/#70477-RawURL-in-error-not-showing-hash. Destructuring rawUrl from the log object and preferring it over req.referrer when setting the UrlReferrer query param. --- lib/pino-http-send.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pino-http-send.mjs b/lib/pino-http-send.mjs index f867a9a..24dbe94 100644 --- a/lib/pino-http-send.mjs +++ b/lib/pino-http-send.mjs @@ -51,7 +51,7 @@ const createWriteStream = function (options = {}) { } const { req = {}, ...others } = log; - const { Username = "", time = new Date().toISOString(), hostname, pid, level, ...errorInfo } = others; + const { Username = "", time = new Date().toISOString(), hostname, pid, level, rawUrl, ...errorInfo } = others; const paramsObj = { ...(req.params || {}), ...(req.body || {}) }; // Build query params per line @@ -61,7 +61,7 @@ const createWriteStream = function (options = {}) { queryParams.set("Remote Host", req.remoteAddress || ""); queryParams.set("User Agent", req.userAgent || ""); queryParams.set("Absolute Url", req.url || ""); - queryParams.set("UrlReferrer", req.referrer || ""); + queryParams.set("UrlReferrer", rawUrl || req.referrer || ""); queryParams.set("Date/ Time (UTC)", time); queryParams.set("User", Username); queryParams.set("exception", JSON.stringify(errorInfo));