diff --git a/packages/proxygen/src/helpers.ts b/packages/proxygen/src/helpers.ts index a8ee98b72..5f6d57462 100644 --- a/packages/proxygen/src/helpers.ts +++ b/packages/proxygen/src/helpers.ts @@ -50,7 +50,7 @@ export function proxygenErrorHandler(error: unknown, logger: Logger) { stack: error.stack, message: error.message, config: { - data: error.config?.data, + data: (error.config?.data ?? "").toString().slice(0, 255), // limit to first 255 chars as it may be full spec headers: error.config?.headers, method: error.config?.method, url: error.config?.url diff --git a/packages/proxygen/tests/proxygenInstanceDelete.test.ts b/packages/proxygen/tests/proxygenInstanceDelete.test.ts index b63770100..9f3de1409 100644 --- a/packages/proxygen/tests/proxygenInstanceDelete.test.ts +++ b/packages/proxygen/tests/proxygenInstanceDelete.test.ts @@ -95,7 +95,7 @@ describe("Unit test for proxygenInstanceDelete", function () { status: 500, message: "Request failed with status code 500", config: { - data: undefined, + data: "", headers: expect.objectContaining({ Accept: "application/json, text/plain, */*", "Content-Type": "application/json", @@ -142,7 +142,7 @@ describe("Unit test for proxygenInstanceDelete", function () { axiosError: expect.objectContaining({ message: "Something awful happened", config: { - data: undefined, + data: "", headers: expect.objectContaining({ Accept: "application/json, text/plain, */*", "Content-Type": "application/json", diff --git a/packages/proxygen/tests/proxygenInstanceGet.test.ts b/packages/proxygen/tests/proxygenInstanceGet.test.ts index 9d3709f61..3f5757018 100644 --- a/packages/proxygen/tests/proxygenInstanceGet.test.ts +++ b/packages/proxygen/tests/proxygenInstanceGet.test.ts @@ -93,7 +93,7 @@ describe("Unit test for proxygenInstanceGet", function () { status: 500, message: "Request failed with status code 500", config: { - data: undefined, + data: "", headers: expect.objectContaining({ Accept: "application/json, text/plain, */*", "Content-Type": "application/json", @@ -139,7 +139,7 @@ describe("Unit test for proxygenInstanceGet", function () { axiosError: expect.objectContaining({ message: "Something awful happened", config: { - data: undefined, + data: "", headers: expect.objectContaining({ Accept: "application/json, text/plain, */*", "Content-Type": "application/json",