Skip to content

Commit

Permalink
Disable option
Browse files Browse the repository at this point in the history
  • Loading branch information
brianquinlan committed Sep 14, 2023
1 parent 8a833aa commit 2514b15
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

group('defaultSessionConfiguration', () {
testAll(CupertinoClient.defaultSessionConfiguration);
testAll(CupertinoClient.defaultSessionConfiguration,
reasonableInvalidStatusLineHandling: false);
});
group('fromSessionConfiguration', () {
final config = URLSessionConfiguration.ephemeralSessionConfiguration();
testAll(() => CupertinoClient.fromSessionConfiguration(config),
canWorkInIsolates: false);
canWorkInIsolates: false, reasonableInvalidStatusLineHandling: false);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,18 @@ export 'src/server_errors_test.dart' show testServerErrors;
/// If [canWorkInIsolates] is `false` then tests that require that the [Client]
/// work in Isolates other than the main isolate will be skipped.
///
/// If [reasonableInvalidStatusLineHandling] is `false` the tests related to
/// invalid `Status-Line`s are skipped.
///
/// The tests are run against a series of HTTP servers that are started by the
/// tests. If the tests are run in the browser, then the test servers are
/// started in another process. Otherwise, the test servers are run in-process.
void testAll(Client Function() clientFactory,
{bool canStreamRequestBody = true,
bool canStreamResponseBody = true,
bool redirectAlwaysAllowed = false,
bool canWorkInIsolates = true}) {
bool canWorkInIsolates = true,
bool reasonableInvalidStatusLineHandling = true}) {
testRequestBody(clientFactory());
testRequestBodyStreamed(clientFactory(),
canStreamRequestBody: canStreamRequestBody);
Expand All @@ -66,7 +70,8 @@ void testAll(Client Function() clientFactory,
canStreamResponseBody: canStreamResponseBody);
testRequestHeaders(clientFactory());
testResponseHeaders(clientFactory());
testResponseStatusLine(clientFactory());
testResponseStatusLine(clientFactory(),
reasonableInvalidStatusLineHandling: reasonableInvalidStatusLineHandling);
testRedirect(clientFactory(), redirectAlwaysAllowed: redirectAlwaysAllowed);
testServerErrors(clientFactory());
testCompressedResponseBody(clientFactory());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import 'response_status_line_server_vm.dart'
if (dart.library.html) 'response_status_line_server_web.dart';

/// Tests that the [Client] correctly processes the response status line.
void testResponseStatusLine(Client client) async {
///
/// If [reasonableInvalidStatusLineHandling] is `false` the tests related to
/// invalid `Status-Line`s are skipped.
void testResponseStatusLine(Client client,
{required bool reasonableInvalidStatusLineHandling}) async {
group('response status line', () {
late String host;
late StreamChannel<Object?> httpServerChannel;
Expand Down Expand Up @@ -62,5 +66,8 @@ void testResponseStatusLine(Client client) async {
}
},
);
});
},
skip: reasonableInvalidStatusLineHandling
? false
: 'does handle invalid request lines in a sensible way');
}

0 comments on commit 2514b15

Please sign in to comment.