More HttpClientResponse implements Stream<Uint8List> fixes (#35149)

https://github.com/dart-lang/sdk/issues/36900
This commit is contained in:
Todd Volkert 2019-06-26 16:56:10 -07:00 committed by GitHub
parent 3ead8a402a
commit 883d6eadcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -233,7 +233,7 @@ class MockHttpClientRequest implements io.HttpClientRequest {
}
}
class MockHttpClientResponse extends Stream<List<int>> implements io.HttpClientResponse {
class MockHttpClientResponse implements io.HttpClientResponse {
MockHttpClientResponse(this.statusCode);
@override
@ -253,6 +253,11 @@ class MockHttpClientResponse extends Stream<List<int>> implements io.HttpClientR
.listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
}
@override
Future<dynamic> forEach(void Function(Uint8List element) action) {
return Future<void>.error(const io.SocketException('test'));
}
@override
dynamic noSuchMethod(Invocation invocation) {
throw 'io.HttpClientResponse - $invocation';

View File

@ -1286,7 +1286,7 @@ class MockHttpClientRequest implements HttpClientRequest {
}
}
class MockHttpClientResponse extends Stream<List<int>> implements HttpClientResponse {
class MockHttpClientResponse implements HttpClientResponse {
MockHttpClientResponse(this.statusCode, {this.result});
@override
@ -1313,6 +1313,12 @@ class MockHttpClientResponse extends Stream<List<int>> implements HttpClientResp
.listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
}
@override
Future<dynamic> forEach(void Function(Uint8List element) action) {
action(Uint8List.fromList(result.codeUnits));
return Future<void>.value();
}
@override
dynamic noSuchMethod(Invocation invocation) {
throw 'io.HttpClientResponse - $invocation';