HttpClient
Captures errors on failed requests from Fetch and XHR and attaches request and response information.
This integration only works inside a browser environment.
Import name: Sentry.httpClientIntegration
This integration captures errors on failed requests from Fetch and XHR and attaches request and response information.
By default, error events don't contain header or cookie data. You can change this behavior by setting sendDefaultPii: true
in your root Sentry.init({})
config.
import * as Sentry from "@sentry/browser";
Sentry.init({
dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
integrations: [Sentry.httpClientIntegration()]
// This option is required for capturing headers and cookies.
sendDefaultPii: true,
});
Note
Due to the limitations of the Fetch and XHR API, the cookie and header collection for requests and responses is based on best effort. This means that certain headers may be missing in the event created by the integration.
Type: (number|[number, number])[]
This array can contain tuples of [begin, end]
(both inclusive), single status codes, or a combination of the two. Default: [[500, 599]]
Type: (string|RegExp)[]
An array of request targets that should be considered, for example ['http://example.com/api/test']
would interpret any request to this URL as a failure. This array can contain Regexes, strings, or a combination of the two. Default: [/.*/]
Type: boolean
This option has to be specified on the root Sentry.init options, not the integration options!
This option is required for capturing headers and cookies.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").