Skip to content

Commit

Permalink
Cast HttpRequest and HttpClientResponse streams to List<int> (#384)
Browse files Browse the repository at this point in the history
In preparation for a change to HttpRequest and HttpClientResponse
whereby they'll implement `Stream<Uint8List>` rather than
`Stream<List<int>>`, this change casts those streams to
`Stream<List<int>>` before any calls to `transform()` those
streams.

This is a forwards-compatible change that should be a no-op for
existing usages.

dart-lang/sdk#36900
#383
  • Loading branch information
tvolkert authored and athomas committed Jun 11, 2019
1 parent 4357277 commit dc528a3
Show file tree
Hide file tree
Showing 163 changed files with 168 additions and 168 deletions.
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/addCredentials_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test() async {
.then((HttpClientRequest request) {
return request.close();
}).then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/authenticateProxy_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ test() async {
"http://${InternetAddress.loopbackIPv4.address}:${server.port}"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {});
response.cast<List<int>>().transform(utf8.decoder).listen((content) {});
});
}

Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/authenticateProxy_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ test() async {
"http://${InternetAddress.loopbackIPv4.address}:${server.port}"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {});
response.cast<List<int>>().transform(utf8.decoder).listen((content) {});
});
}

Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/authenticateProxy_A02_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ test() async {
"http://${InternetAddress.loopbackIPv4.address}:${server.port}"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {});
response.cast<List<int>>().transform(utf8.decoder).listen((content) {});
});
}

Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/authenticate_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ test() async {
"http://${InternetAddress.loopbackIPv4.address}:${server.port}/xxx"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {});
response.cast<List<int>>().transform(utf8.decoder).listen((content) {});
});
}

Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/authenticate_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test() async {
"http://${InternetAddress.loopbackIPv4.address}:${server.port}/xxx"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {});
response.cast<List<int>>().transform(utf8.decoder).listen((content) {});
});
}

Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/authenticate_A02_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test() async {
"http://${InternetAddress.loopbackIPv4.address}:${server.port}/xxx"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {});
response.cast<List<int>>().transform(utf8.decoder).listen((content) {});
});
}

Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/autoUncompress_A02_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test() async {
.then((HttpClientRequest request) {
return request.close();
}).then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
asyncEnd();
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/autoUncompress_A02_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test() async {
.then((HttpClientRequest request) {
return request.close();
}).then((HttpClientResponse response) {
response.transform(gzip.decoder).transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(gzip.decoder).transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
asyncEnd();
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/autoUncompress_A03_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test() async {
Expect.listEquals([helloWorld.length.toString()],
response.headers[HttpHeaders.contentLengthHeader]);
Expect.listEquals(["utf-8"], response.headers[HttpHeaders.contentEncodingHeader]);
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
asyncEnd();
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/autoUncompress_A04_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test() async {
.then((HttpClientRequest request) {
return request.close();
}).then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
Expect.equals("gzip", response.headers.value(HttpHeaders.contentEncodingHeader));
asyncEnd();
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/autoUncompress_A04_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test() async {
}).then((HttpClientResponse response) {
// Server sends uncompressed data. autoUncompress sets to true but
// uncompression should not be performed
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
asyncEnd();
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/autoUncompress_A04_t03.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test() async {
// Server sends uncompressed data but on client autoUncompress sets to true
// and Content-Encoding header value is gzip so we are trying to uncompress
// not compressed data
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
}, onError: (_) {
asyncEnd();
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/close_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test() async {
client.getUrl(Uri.parse("http://${localhost}:${server.port}"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
client.close(force: true);

Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/deleteUrl_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test() async {
client.deleteUrl(Uri.parse("http://${localhost}:${server.port}/xxx"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/deleteUrl_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test() async {
.parse("http://${localhost}:${server.port}/y/xxx?q=12&i=j#fragment"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/delete_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test() async {
client.delete(localhost, server.port, "/xxx")
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/delete_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test() async {
client.delete(localhost, server.port, "y/Xxx?q=12&i=j#fragment")
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ test() async {
client.get(localhost, server.port, "")
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(hello, content);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ test() async {
client.get(localhost, server.port, "")
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(hello, content);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ test() async {
client.get(localhost, server.port, "")
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(hello, content);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ test() async {
client.get(localhost, server.port, "")
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(hello, content);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ test() async {
client.get(localhost, server.port, "")
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(hello, content);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ test() async {
client.get(localhost, server.port, "")
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(hello, content);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ test() async {
client.get(localhost, server.port, "")
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(hello, content);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ test() async {
client.get(localhost, server.port, "")
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(hello, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/findProxy_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ test() async {
"http://${InternetAddress.loopbackIPv4.address}:${server.port}"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {});
response.cast<List<int>>().transform(utf8.decoder).listen((content) {});
});
}

Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/findProxy_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ test() async {
"http://${InternetAddress.loopbackIPv4.address}:${server.port}"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {});
response.cast<List<int>>().transform(utf8.decoder).listen((content) {});
});
}

Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/findProxy_A02_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test() async {
"http://${InternetAddress.loopbackIPv4.address}:${server.port}"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {});
response.cast<List<int>>().transform(utf8.decoder).listen((content) {});
});
}

Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/findProxy_A02_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test() async {
"http://${InternetAddress.loopbackIPv4.address}:${server.port}"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {});
response.cast<List<int>>().transform(utf8.decoder).listen((content) {});
});
}

Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/findProxy_A03_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ test() async {
"http://${InternetAddress.loopbackIPv4.address}:${server.port}"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {});
response.cast<List<int>>().transform(utf8.decoder).listen((content) {});
});
}

Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/findProxy_A03_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ test() async {
"http://${InternetAddress.loopbackIPv4.address}:${server.port}"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {});
response.cast<List<int>>().transform(utf8.decoder).listen((content) {});
});
}

Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/getUrl_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test() async {
Expect.equals("GET", request.method);
return request.close();
}).then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/getUrl_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test() async {
.parse("http://${localhost}:${server.port}/y/xxx?q=12&i=j#fragment"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/get_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test() async {
Expect.equals("GET", request.method);
return request.close();
}).then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/get_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test() async {
client.get(localhost, server.port, "y/Xxx?q=12&i=j#fragment")
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/headUrl_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test() async {
Expect.equals("HEAD", request.method);
return request.close();
}).then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/headUrl_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test() async {
.parse("http://${localhost}:${server.port}/y/xxx?q=12&i=j#fragment"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/head_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test() async {
Expect.equals("HEAD", request.method);
return request.close();
}).then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/head_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test() async {
client.head(localhost, server.port, "y/Xxx?q=12&i=j#fragment")
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/idleTimeout_A02_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test() async {
request.headers.set(HttpHeaders.connectionHeader, "keep-alive");
return request.close();
}).then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld + helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/openUrl_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test() async {
Expect.equals("GET", request.method);
return request.close();
}).then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/openUrl_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test() async {
Uri.parse("http://${localhost}:${server.port}/y/xxx?q=12&i=j#fragment"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down
2 changes: 1 addition & 1 deletion LibTest/io/HttpClient/openUrl_A01_t03.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test() async {
Uri.parse("http://${localhost}:${server.port}/Xxx?q=12&i=j#fragment"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(utf8.decoder).listen((content) {
response.cast<List<int>>().transform(utf8.decoder).listen((content) {
Expect.equals(helloWorld, content);
});
});
Expand Down

0 comments on commit dc528a3

Please sign in to comment.