mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
More HttpClientResponse implements Stream<Uint8List> fixes (#35149)
https://github.com/dart-lang/sdk/issues/36900
This commit is contained in:
parent
3ead8a402a
commit
883d6eadcb
@ -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';
|
||||
|
||||
@ -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';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user