From ff85c0728c6f830c5f0b139ad21b5f07567e71b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Uek=C3=B6tter?= Date: Mon, 13 Feb 2023 16:11:28 +0100 Subject: [PATCH 1/8] Update to dio 5 --- dio/lib/src/breadcrumb_client_adapter.dart | 2 +- dio/lib/src/sentry_dio_client_adapter.dart | 2 +- dio/lib/src/tracing_client_adapter.dart | 4 ++-- dio/pubspec.yaml | 2 +- dio/test/dio_error_extractor_test.dart | 6 ++++-- dio/test/dio_event_processor_test.dart | 3 ++- dio/test/mocks/mock_http_client_adapter.dart | 5 +++-- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/dio/lib/src/breadcrumb_client_adapter.dart b/dio/lib/src/breadcrumb_client_adapter.dart index 22391e2954..17233d984e 100644 --- a/dio/lib/src/breadcrumb_client_adapter.dart +++ b/dio/lib/src/breadcrumb_client_adapter.dart @@ -11,7 +11,7 @@ import 'package:sentry/sentry.dart'; /// Remarks: /// If this client is used as a wrapper, a call to close also closes the /// given client. -class BreadcrumbClientAdapter extends HttpClientAdapter { +class BreadcrumbClientAdapter implements HttpClientAdapter { // ignore: public_member_api_docs BreadcrumbClientAdapter({required HttpClientAdapter client, Hub? hub}) : _hub = hub ?? HubAdapter(), diff --git a/dio/lib/src/sentry_dio_client_adapter.dart b/dio/lib/src/sentry_dio_client_adapter.dart index b9536b1fc7..453e64062d 100644 --- a/dio/lib/src/sentry_dio_client_adapter.dart +++ b/dio/lib/src/sentry_dio_client_adapter.dart @@ -20,7 +20,7 @@ import 'breadcrumb_client_adapter.dart'; /// Remarks: /// HTTP traffic can contain PII (personal identifiable information). /// Read more on data scrubbing [here](https://docs.sentry.io/product/data-management-settings/advanced-datascrubbing/). -class SentryDioClientAdapter extends HttpClientAdapter { +class SentryDioClientAdapter implements HttpClientAdapter { // ignore: public_member_api_docs SentryDioClientAdapter({ required HttpClientAdapter client, diff --git a/dio/lib/src/tracing_client_adapter.dart b/dio/lib/src/tracing_client_adapter.dart index c24d26be5d..4e23207423 100644 --- a/dio/lib/src/tracing_client_adapter.dart +++ b/dio/lib/src/tracing_client_adapter.dart @@ -8,7 +8,7 @@ import 'package:sentry/sentry.dart'; /// A [Dio](https://pub.dev/packages/dio)-package compatible HTTP client adapter /// which adds support to Sentry Performance feature. /// https://develop.sentry.dev/sdk/performance -class TracingClientAdapter extends HttpClientAdapter { +class TracingClientAdapter implements HttpClientAdapter { // ignore: public_member_api_docs TracingClientAdapter({required HttpClientAdapter client, Hub? hub}) : _hub = hub ?? HubAdapter(), @@ -54,7 +54,7 @@ class TracingClientAdapter extends HttpClientAdapter { } response = await _client.fetch(options, requestStream, cancelFuture); - span?.status = SpanStatus.fromHttpStatusCode(response.statusCode ?? -1); + span?.status = SpanStatus.fromHttpStatusCode(response.statusCode); } catch (exception) { span?.throwable = exception; span?.status = const SpanStatus.internalError(); diff --git a/dio/pubspec.yaml b/dio/pubspec.yaml index 90aa62f151..2e3128ead6 100644 --- a/dio/pubspec.yaml +++ b/dio/pubspec.yaml @@ -9,7 +9,7 @@ environment: sdk: '>=2.17.0 <4.0.0' dependencies: - dio: ^4.0.0 + dio: ^5.0.0 sentry: 7.0.0-beta.4 dev_dependencies: diff --git a/dio/test/dio_error_extractor_test.dart b/dio/test/dio_error_extractor_test.dart index 94e9fda8f4..de7203ae0e 100644 --- a/dio/test/dio_error_extractor_test.dart +++ b/dio/test/dio_error_extractor_test.dart @@ -17,7 +17,8 @@ void main() { final dioError = DioError( error: exception, requestOptions: RequestOptions(path: '/foo/bar'), - )..stackTrace = stacktrace; + stackTrace: stacktrace, + ); final cause = sut.cause(dioError); @@ -31,7 +32,8 @@ void main() { final dioError = DioError( requestOptions: RequestOptions(path: '/foo/bar'), - )..stackTrace = stacktrace; + stackTrace: stacktrace, + ); final cause = sut.cause(dioError); diff --git a/dio/test/dio_event_processor_test.dart b/dio/test/dio_event_processor_test.dart index 26d442ca1b..91c059b020 100644 --- a/dio/test/dio_event_processor_test.dart +++ b/dio/test/dio_event_processor_test.dart @@ -195,7 +195,8 @@ void main() { final dioError = DioError( error: exception, requestOptions: requestOptions, - )..stackTrace = StackTrace.current; + stackTrace: StackTrace.current, + ); final extracted = fixture.exceptionFactory.extractor.flatten(dioError, null); diff --git a/dio/test/mocks/mock_http_client_adapter.dart b/dio/test/mocks/mock_http_client_adapter.dart index 8f55d6b9d1..335c9213b0 100644 --- a/dio/test/mocks/mock_http_client_adapter.dart +++ b/dio/test/mocks/mock_http_client_adapter.dart @@ -12,8 +12,9 @@ typedef MockFetchMethod = Future Function( typedef MockCloseMethod = void Function({bool force}); -class MockHttpClientAdapter extends HttpClientAdapter - with NoSuchMethodProvider { +class MockHttpClientAdapter + with NoSuchMethodProvider + implements HttpClientAdapter { MockHttpClientAdapter(this.mockFetchMethod, {this.mockCloseMethod}); final MockFetchMethod mockFetchMethod; From 371b882ef703f6168dc71d921c41edc277bec1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Uek=C3=B6tter?= Date: Mon, 13 Feb 2023 16:16:46 +0100 Subject: [PATCH 2/8] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1490a7b5ce..b2e0055005 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixes - Set client name with version in Android SDK ([#1274](https://github.com/getsentry/sentry-dart/pull/1274)) +- Update `sentry_dio` to dio v5 ([#1282](https://github.com/getsentry/sentry-dart/pull/1282)) ## 7.0.0-beta.4 From 81c2f69d1be9112d99488a12376b57e1d2b99859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Uek=C3=B6tter?= Date: Tue, 14 Feb 2023 12:53:31 +0100 Subject: [PATCH 3/8] fix tests --- dio/test/breadcrumb_client_adapter_test.dart | 2 +- dio/test/dio_event_processor_test.dart | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/dio/test/breadcrumb_client_adapter_test.dart b/dio/test/breadcrumb_client_adapter_test.dart index 29058db7d2..28fa4769df 100644 --- a/dio/test/breadcrumb_client_adapter_test.dart +++ b/dio/test/breadcrumb_client_adapter_test.dart @@ -98,7 +98,7 @@ void main() { await sut.get('/'); fail('Method did not throw'); } on DioError catch (e) { - expect(e.message, 'Exception: test'); + expect(e.error.toString(), 'Exception: test'); expect(e.requestOptions.uri, Uri.parse('https://example.com/')); } diff --git a/dio/test/dio_event_processor_test.dart b/dio/test/dio_event_processor_test.dart index 91c059b020..904d13b3cf 100644 --- a/dio/test/dio_event_processor_test.dart +++ b/dio/test/dio_event_processor_test.dart @@ -75,7 +75,6 @@ void main() { expect(processedEvent.request?.queryString, 'foo=bar'); expect(processedEvent.request?.headers, { 'foo': 'bar', - 'content-type': 'application/json; charset=utf-8' }); expect(processedEvent.request?.data, 'foobar'); }); From 9287fe69f063308e70841b6f4a991ba689b610e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Uek=C3=B6tter?= Date: Tue, 14 Feb 2023 13:00:50 +0100 Subject: [PATCH 4/8] set constrain for example app --- flutter/example/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flutter/example/pubspec.yaml b/flutter/example/pubspec.yaml index 1bfef18e28..72cc64b1b7 100644 --- a/flutter/example/pubspec.yaml +++ b/flutter/example/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: universal_platform: ^1.0.0 feedback: ^2.0.0 provider: ^6.0.0 - dio: ^4.0.0 + dio: any # This gets constrained by `sentry_dio` logging: ^1.0.0 package_info_plus: ^3.0.0 path_provider: ^2.0.0 From 08e336928e7d9f897e27dd34f48a5ebf3231044b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Uek=C3=B6tter?= Date: Tue, 14 Feb 2023 13:03:27 +0100 Subject: [PATCH 5/8] another round of constraints --- min_version_test/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/min_version_test/pubspec.yaml b/min_version_test/pubspec.yaml index ec3b0a9023..83b8188ece 100644 --- a/min_version_test/pubspec.yaml +++ b/min_version_test/pubspec.yaml @@ -32,7 +32,7 @@ dependencies: sentry_flutter: sentry_dio: sentry_logging: - dio: ^4.0.0 + dio: any # This gets constrained by `sentry_dio` logging: ^1.0.0 dev_dependencies: From c2017087b954b3560cfedb6dee4d60ee2bac2940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Uek=C3=B6tter?= Date: Fri, 17 Feb 2023 11:03:45 +0100 Subject: [PATCH 6/8] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2e0055005..7659fab958 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Fixes - Set client name with version in Android SDK ([#1274](https://github.com/getsentry/sentry-dart/pull/1274)) + +### Breaking Changes + - Update `sentry_dio` to dio v5 ([#1282](https://github.com/getsentry/sentry-dart/pull/1282)) ## 7.0.0-beta.4 From 2645db2d2cc6b59eec83dc4a3a5096e37b07dcb6 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 1 Mar 2023 17:22:17 +0100 Subject: [PATCH 7/8] fix changelog --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 247a3460ce..a3117460cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Breaking Changes + +- Update `sentry_dio` to dio v5 ([#1282](https://github.com/getsentry/sentry-dart/pull/1282)) + ## 6.21.0 ### Features @@ -25,10 +29,6 @@ - Set client name with version in Android SDK ([#1274](https://github.com/getsentry/sentry-dart/pull/1274)) -### Breaking Changes - -- Update `sentry_dio` to dio v5 ([#1282](https://github.com/getsentry/sentry-dart/pull/1282)) - ## 7.0.0-beta.4 ### Features From d77f04f822505cba831b94b37d392bf1d65f8427 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 1 Mar 2023 17:23:48 +0100 Subject: [PATCH 8/8] fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1e88e7a33..c0efd936cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Breaking Changes - Update `sentry_dio` to dio v5 ([#1282](https://github.com/getsentry/sentry-dart/pull/1282)) + ### Dependencies - Bump Android SDK from v6.13.1 to v6.14.0 ([#1287](https://github.com/getsentry/sentry-dart/pull/1287))