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
12 changes: 10 additions & 2 deletions packages/devtools_app/lib/src/http/http_request_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,24 @@ class HttpRequestData extends NetworkRequest {
}
}

// Stitch together response as it may have been sent in multiple chunks.
final encodedData = <int>[];
for (final event in responseEvents) {
final traceEvent = TraceEvent(event);
// TODO(kenz): do we need to do something with the other response events
// (phases 'b' and 'e')?
if (traceEvent.phase == TraceEvent.asyncInstantPhase &&
traceEvent.name == 'Response body') {
final encodedData = (traceEvent.args['data'] as List).cast<int>();
encodedData.addAll((traceEvent.args['data'] as List).cast<int>());
}
}

try {
if (encodedData.isNotEmpty) {
responseBody = utf8.decode(encodedData);
break;
}
} on FormatException {
// Non-UTF8 response.
Copy link
Member

Choose a reason for hiding this comment

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

Should we do something to handle non UTF8 responses so that the user has some indication that we did receive a response? What is an example of a non-utf8 response?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

An image is an example of a non-UTF8 response. If we try and decode that, it's certain to blow up.

}

final data = HttpRequestData._(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
4 changes: 2 additions & 2 deletions packages/devtools_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ packages:
source: hosted
version: "1.2.0"
string_scanner:
dependency: transitive
dependency: "direct main"
description:
name: string_scanner
url: "https://pub.dartlang.org"
Expand Down Expand Up @@ -709,4 +709,4 @@ packages:
version: "2.2.1"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
flutter: ">=1.22.0 <2.0.0"
flutter: ">=1.22.0"