Prepare for upcoming change to HttpRequest and HttpClientResponse
An upcoming change to the Dart SDK will change `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. https://github.com/dart-lang/sdk/issues/36900
This commit is contained in:
parent
f253722ef7
commit
16e3a5a3a0
1 changed files with 1 additions and 1 deletions
|
@ -79,7 +79,7 @@ main() {
|
||||||
var client = new HttpClient();
|
var client = new HttpClient();
|
||||||
var rq = await client.openUrl('GET', Uri.parse('$url/hijack'));
|
var rq = await client.openUrl('GET', Uri.parse('$url/hijack'));
|
||||||
var rs = await rq.close();
|
var rs = await rq.close();
|
||||||
var body = await rs.transform(utf8.decoder).join();
|
var body = await rs.cast<List<int>>().transform(utf8.decoder).join();
|
||||||
print('Response: $body');
|
print('Response: $body');
|
||||||
expect(json.decode(body), {'error': 'crime'});
|
expect(json.decode(body), {'error': 'crime'});
|
||||||
} on HttpException catch (e, st) {
|
} on HttpException catch (e, st) {
|
||||||
|
|
Loading…
Reference in a new issue