File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
pkgs/http_client_conformance_tests/lib/src Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -109,14 +109,19 @@ void testAbort(
109109 );
110110 final response = await client.send (request);
111111
112+ // We want to count data bytes, not 'packet' count, because different
113+ // clients will use different size/numbers of 'packet's
112114 var i = 0 ;
113- final subscription = response.stream.listen ((data) {
114- ++ i;
115- if (i == 1000 ) abortTrigger.complete ();
116- }).asFuture <void >();
117- expect (subscription, throwsA (isA <AbortedRequest >()));
118- await subscription.catchError ((_) => null );
119- expect (i, 1000 );
115+ expect (
116+ response.stream.listen (
117+ (data) {
118+ i += data.length;
119+ if (i >= 1000 && ! abortTrigger.isCompleted) abortTrigger.complete ();
120+ },
121+ ).asFuture <void >(),
122+ throwsA (isA <AbortedRequest >()),
123+ );
124+ expect (i, lessThan (48890 ));
120125 }, skip: canStreamResponseBody ? false : 'does not stream response bodies' );
121126
122127 test ('after streaming response' , () async {
You can’t perform that action at this time.
0 commit comments