Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### 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))
Expand Down
2 changes: 1 addition & 1 deletion dio/lib/src/breadcrumb_client_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion dio/lib/src/sentry_dio_client_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions dio/lib/src/tracing_client_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion dio/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion dio/test/breadcrumb_client_adapter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void main() {
await sut.get<dynamic>('/');
fail('Method did not throw');
} on DioError catch (e) {
expect(e.message, 'Exception: test');
expect(e.error.toString(), 'Exception: test');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is due to changes in dio

expect(e.requestOptions.uri, Uri.parse('https://example.com/'));
}

Expand Down
6 changes: 4 additions & 2 deletions dio/test/dio_error_extractor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -31,7 +32,8 @@ void main() {

final dioError = DioError(
requestOptions: RequestOptions(path: '/foo/bar'),
)..stackTrace = stacktrace;
stackTrace: stacktrace,
);

final cause = sut.cause(dioError);

Expand Down
4 changes: 2 additions & 2 deletions dio/test/dio_event_processor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ void main() {
expect(processedEvent.request?.queryString, 'foo=bar');
expect(processedEvent.request?.headers, <String, String>{
'foo': 'bar',
'content-type': 'application/json; charset=utf-8'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dio doesn't apply a content-type by itself anymore

});
expect(processedEvent.request?.data, 'foobar');
});
Expand Down Expand Up @@ -195,7 +194,8 @@ void main() {
final dioError = DioError(
error: exception,
requestOptions: requestOptions,
)..stackTrace = StackTrace.current;
stackTrace: StackTrace.current,
);

final extracted =
fixture.exceptionFactory.extractor.flatten(dioError, null);
Expand Down
5 changes: 3 additions & 2 deletions dio/test/mocks/mock_http_client_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ typedef MockFetchMethod = Future<ResponseBody> 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;
Expand Down
2 changes: 1 addition & 1 deletion flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion min_version_test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down