SentryHttpClient constructor
SentryHttpClient({})
Implementation
SentryHttpClient({
Client? client,
Hub? hub,
List<SentryStatusCode> failedRequestStatusCodes =
defaultFailedRequestStatusCodes,
List<String> failedRequestTargets = defaultFailedRequestTargets,
bool? captureFailedRequests,
}) {
_hub = hub ?? HubAdapter();
var innerClient = client ?? Client();
innerClient = FailedRequestClient(
failedRequestStatusCodes: failedRequestStatusCodes,
failedRequestTargets: failedRequestTargets,
hub: _hub,
client: innerClient,
captureFailedRequests: captureFailedRequests,
);
if (_hub.options.isTracingEnabled()) {
innerClient = TracingClient(client: innerClient, hub: _hub);
_hub.options.sdk.addIntegration('HTTPNetworkTracing');
}
// The ordering here matters.
// We don't want to include the breadcrumbs for the current request
// when capturing it as a failed request.
// However it still should be added for following events.
if (_hub.options.recordHttpBreadcrumbs) {
innerClient = BreadcrumbClient(client: innerClient, hub: _hub);
}
_client = innerClient;
}