From ae11d96e182d91ddbcaaff022cc6f8a8e87ab4b3 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Thu, 31 Jul 2025 13:15:41 +0200 Subject: [PATCH 1/2] ref(browser): Add more specific `mechanism.type` to errors captured by `httpClientIntegration` --- packages/browser/src/integrations/httpclient.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/browser/src/integrations/httpclient.ts b/packages/browser/src/integrations/httpclient.ts index 9aaa476b7618..06e8530a98d6 100644 --- a/packages/browser/src/integrations/httpclient.ts +++ b/packages/browser/src/integrations/httpclient.ts @@ -93,6 +93,7 @@ function _fetchResponseHandler( requestCookies, responseCookies, error, + type: 'fetch', }); captureEvent(event); @@ -165,6 +166,7 @@ function _xhrResponseHandler( responseHeaders, responseCookies, error, + type: 'xhr', }); captureEvent(event); @@ -362,6 +364,7 @@ function _createEvent(data: { url: string; method: string; status: number; + type: 'fetch' | 'xhr'; responseHeaders?: Record; responseCookies?: Record; requestHeaders?: Record; @@ -402,7 +405,7 @@ function _createEvent(data: { }; addExceptionMechanism(event, { - type: 'http.client', + type: `http.client.${data.type}`, handled: false, }); From c86ef3cfe7ecbb6d8322593739f56c271638c3ee Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Fri, 1 Aug 2025 16:02:38 +0200 Subject: [PATCH 2/2] fix tests --- .../suites/integrations/httpclient/axios/test.ts | 2 +- .../suites/integrations/httpclient/fetch/simple/test.ts | 2 +- .../suites/integrations/httpclient/fetch/withRequest/test.ts | 2 +- .../httpclient/fetch/withRequestAndBodyAndOptions/test.ts | 2 +- .../integrations/httpclient/fetch/withRequestAndOptions/test.ts | 2 +- .../suites/integrations/httpclient/xhr/test.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/axios/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/axios/test.ts index 90d2e33f60e0..07a3f1e71b43 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/axios/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/axios/test.ts @@ -36,7 +36,7 @@ sentryTest( type: 'Error', value: 'HTTP Client Error with status code: 500', mechanism: { - type: 'http.client', + type: 'http.client.xhr', handled: false, }, stacktrace: { diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts index dcf7ed5ca8b1..71cc3a1112a5 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts @@ -38,7 +38,7 @@ sentryTest( type: 'Error', value: 'HTTP Client Error with status code: 500', mechanism: { - type: 'http.client', + type: 'http.client.fetch', handled: false, }, stacktrace: { diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequest/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequest/test.ts index 46b886c49757..75765fb8c95b 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequest/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequest/test.ts @@ -34,7 +34,7 @@ sentryTest('works with a Request passed in', async ({ getLocalTestUrl, page }) = type: 'Error', value: 'HTTP Client Error with status code: 500', mechanism: { - type: 'http.client', + type: 'http.client.fetch', handled: false, }, stacktrace: { diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndBodyAndOptions/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndBodyAndOptions/test.ts index fdd6fd429b73..3f3dc0d4b754 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndBodyAndOptions/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndBodyAndOptions/test.ts @@ -36,7 +36,7 @@ sentryTest( type: 'Error', value: 'HTTP Client Error with status code: 500', mechanism: { - type: 'http.client', + type: 'http.client.fetch', handled: false, }, stacktrace: { diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndOptions/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndOptions/test.ts index d952ae2562ef..4e8e64a40c00 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndOptions/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndOptions/test.ts @@ -34,7 +34,7 @@ sentryTest('works with a Request (without body) & options passed in', async ({ g type: 'Error', value: 'HTTP Client Error with status code: 500', mechanism: { - type: 'http.client', + type: 'http.client.fetch', handled: false, }, stacktrace: { diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/xhr/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/xhr/test.ts index a0e11021ec67..2ba8ca5049cf 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/xhr/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/xhr/test.ts @@ -36,7 +36,7 @@ sentryTest( type: 'Error', value: 'HTTP Client Error with status code: 500', mechanism: { - type: 'http.client', + type: 'http.client.xhr', handled: false, }, stacktrace: {