Skip to content

Upgrade dependencies (http 0.13.0 etc) for Flutter 2 upgrade #339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased

* Upgrade dependencies (`http 0.13.0` etc) for Flutter 2 upgrade (#339)
* Fix: Do not append stack trace to the exception if there are no frames
* Fix: Empty DSN disables the SDK and runs the App

Expand Down
7 changes: 5 additions & 2 deletions dart/lib/src/noop_client.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:typed_data';
import 'dart:convert';
import 'dart:typed_data';

import 'package:http/http.dart';

class NoOpClient implements Client {
Expand All @@ -22,7 +23,9 @@ class NoOpClient implements Client {
void close() {}

@override
Future<Response> delete(url, {Map<String, String> headers}) => _response;
Future<Response> delete(url,
{Object body, Encoding encoding, Map<String, String> headers}) =>
_response;

@override
Future<Response> get(url, {Map<String, String> headers}) => _response;
Expand Down
2 changes: 1 addition & 1 deletion dart/lib/src/transport/http_transport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class HttpTransport implements Transport {
);

final response = await _options.httpClient.post(
_dsn.postUri,
Uri.parse(_dsn.postUri),
headers: _credentialBuilder.configure(_headers),
body: body,
);
Expand Down
8 changes: 4 additions & 4 deletions dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ environment:
sdk: ">=2.8.0 <3.0.0"

dependencies:
http: ^0.12.0
meta: ^1.0.0
stack_trace: ^1.0.0
uuid: ^2.0.0
http: ^0.13.0
meta: ^1.3.0
stack_trace: ^1.10.0
uuid: ^3.0.1

dev_dependencies:
mockito: ^4.1.3
Expand Down
14 changes: 7 additions & 7 deletions dart/test/http_client/sentry_http_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void main() {

final client = SentryHttpClient(client: mockClient, hub: mockHub);

final response = await client.get('https://example.com');
final response = await client.get(Uri.parse('https://example.com'));
expect(response.statusCode, 200);

final breadcrumb = verify(mockHub.addBreadcrumb(captureAny))
Expand All @@ -47,7 +47,7 @@ void main() {

final client = SentryHttpClient(client: mockClient, hub: mockHub);

final response = await client.get('https://example.com');
final response = await client.get(Uri.parse('https://example.com'));
expect(response.statusCode, 404);

final breadcrumb = verify(mockHub.addBreadcrumb(captureAny))
Expand All @@ -73,7 +73,7 @@ void main() {

final client = SentryHttpClient(client: mockClient, hub: mockHub);

final response = await client.post('https://example.com');
final response = await client.post(Uri.parse('https://example.com'));
expect(response.statusCode, 200);

final breadcrumb = verify(mockHub.addBreadcrumb(captureAny))
Expand All @@ -98,7 +98,7 @@ void main() {

final client = SentryHttpClient(client: mockClient, hub: mockHub);

final response = await client.put('https://example.com');
final response = await client.put(Uri.parse('https://example.com'));
expect(response.statusCode, 200);

final breadcrumb = verify(mockHub.addBreadcrumb(captureAny))
Expand All @@ -123,7 +123,7 @@ void main() {

final client = SentryHttpClient(client: mockClient, hub: mockHub);

final response = await client.delete('https://example.com');
final response = await client.delete(Uri.parse('https://example.com'));
expect(response.statusCode, 200);

final breadcrumb = verify(mockHub.addBreadcrumb(captureAny))
Expand Down Expand Up @@ -156,7 +156,7 @@ void main() {
final client = SentryHttpClient(client: mockClient, hub: mockHub);

try {
await client.get('https://example.com');
await client.get(Uri.parse('https://example.com'));
fail('Method did not throw');
} on ClientException catch (e) {
expect(e.message, 'test');
Expand All @@ -182,7 +182,7 @@ void main() {
final client = SentryHttpClient(client: mockClient, hub: mockHub);

try {
await client.get('https://example.com');
await client.get(Uri.parse('https://example.com'));
fail('Method did not throw');
} on SocketException catch (e) {
expect(e.message, 'test');
Expand Down
2 changes: 1 addition & 1 deletion flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ Future<void> makeWebRequest(BuildContext context) async {
final client = SentryHttpClient();
// We don't do any exception handling here.
// In case of an exception, let it get caught and reported to Sentry
final response = await client.get('https://flutter.dev/');
final response = await client.get(Uri.parse('https://flutter.dev/'));

await showDialog<void>(
context: context,
Expand Down