diff --git a/packages/service-connector/src/index.js b/packages/service-connector/src/index.js index ced859b..b7277a7 100644 --- a/packages/service-connector/src/index.js +++ b/packages/service-connector/src/index.js @@ -20,7 +20,14 @@ const serviceConnector = ({ service, headerIntercepts, loggable, logs = true, .. if (headerIntercepts) { let intercepts = headerIntercepts(config); if (intercepts instanceof Promise) - intercepts = await intercepts.catch((e) => logger.error("Failed to intercept headers", e?.message)); + intercepts = await intercepts.catch((e) => + logger.error( + `Failed to intercept headers - ${coloredString("method")}: ${coloredString( + config.method + )} - ${coloredString("url")}: ${coloredString(`${config.baseURL ?? ""}${config.url}`, "url-value")}`, + e?.message + ) + ); config.headers = { ...config.headers, ...intercepts diff --git a/packages/service-connector/test/index.test.js b/packages/service-connector/test/index.test.js index 498dede..b94f0d0 100644 --- a/packages/service-connector/test/index.test.js +++ b/packages/service-connector/test/index.test.js @@ -97,7 +97,12 @@ describe("service-connector", () => { }); const response = await asyncInterceptedConnector.get("/"); expect(response.status).toEqual(200); - expect(mockLogger.error).toBeCalledWith(`Failed to intercept headers`, undefined); + expect(mockLogger.error).toBeCalledWith( + `Failed to intercept headers - ${coloredString("method")}: ${coloredString("get")} - ${coloredString( + "url" + )}: ${coloredString("https://google.com/", "url-value")}`, + undefined + ); }); });