Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

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