Skip to content

Commit

Permalink
Fix per breaking change to HttpRequest and HttpClientResponse
Browse files Browse the repository at this point in the history
A recent change to the Dart SDK updated `HttpRequest` and
`HttpClientResponse` from implementing `Stream<List<int>>` to
implementing `Stream<Uint8List>`.

This forwards-compatible change prepares for that SDK breaking
change by casting the Stream to `List<int>` before transforming
it.

dart-lang/sdk#36900
  • Loading branch information
tvolkert committed Jun 28, 2019
1 parent 7e532dc commit e4eee16
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
## v2.1.0+1

* Forward-compatible fix for upcoming Dart SDK breaking change
(`HttpClientResponse` implementing `Stream<Uint8List>`)

## v2.1.0

* Full support of JsonWire and W3C protocol specs in sync and async WebDriver.

## v2.0.0
Expand Down
2 changes: 1 addition & 1 deletion lib/src/request/async_io_request_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class AsyncIoRequestClient extends AsyncRequestClient {
final response = await httpRequest.close();

return WebDriverResponse(response.statusCode, response.reasonPhrase,
await utf8.decodeStream(response));
await utf8.decodeStream(response.cast<List<int>>()));
} finally {
_lock.release();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/support/forwarder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class WebDriverForwarder {
}
Map<dynamic, dynamic> params;
if (request.method == 'POST') {
String requestBody = await utf8.decodeStream(request);
String requestBody = await utf8.decodeStream(request.cast<List<int>>());
if (requestBody != null && requestBody.isNotEmpty) {
params = json.decode(requestBody) as Map<dynamic, dynamic>;
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: webdriver
version: 2.1.0
version: 2.1.0+1
authors:
- Marc Fisher II <fisherii@google.com>
- Matt Staats<staats@google.com>
Expand Down

0 comments on commit e4eee16

Please sign in to comment.