Skip to content

Commit

Permalink
pkgs/http_client_conformance_tests: add boolean flag `supportsFoldedH…
Browse files Browse the repository at this point in the history
…eaders`
  • Loading branch information
Anikate-De committed Jun 3, 2024
1 parent 90837df commit 39d20bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ export 'src/server_errors_test.dart' show testServerErrors;
/// If [canReceiveSetCookieHeaders] is `false` then tests that require that
/// "set-cookie" headers be received by the client will not be run.
///
/// If [supportsFoldedHeaders] is `false` then the tests that assume that the
/// [Client] can parse folded headers will be 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.
Expand All @@ -74,6 +77,7 @@ void testAll(
bool redirectAlwaysAllowed = false,
bool canWorkInIsolates = true,
bool preservesMethodCase = false,
bool supportsFoldedHeaders = true,
bool canSendCookieHeaders = false,
bool canReceiveSetCookieHeaders = false,
}) {
Expand All @@ -86,7 +90,8 @@ void testAll(
canStreamResponseBody: canStreamResponseBody);
testRequestHeaders(clientFactory());
testRequestMethods(clientFactory(), preservesMethodCase: preservesMethodCase);
testResponseHeaders(clientFactory());
testResponseHeaders(clientFactory(),
supportsFoldedHeaders: supportsFoldedHeaders);
testResponseStatusLine(clientFactory());
testRedirect(clientFactory(), redirectAlwaysAllowed: redirectAlwaysAllowed);
testServerErrors(clientFactory());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import 'response_headers_server_vm.dart'
if (dart.library.js_interop) 'response_headers_server_web.dart';

/// Tests that the [Client] correctly processes response headers.
void testResponseHeaders(Client client) async {
void testResponseHeaders(Client client,
{bool supportsFoldedHeaders = true}) async {
group('server headers', () {
late String host;
late StreamChannel<Object?> httpServerChannel;
Expand Down Expand Up @@ -177,6 +178,8 @@ void testResponseHeaders(Client client) async {
allOf(matches(RegExp(r'BAR {0,3}[ \t]? {0,7}[ \t]? {0,3}BAZ')),
contains(' ')));
});
});
},
skip:
!supportsFoldedHeaders ? 'does not support folded headers' : false);
});
}

0 comments on commit 39d20bb

Please sign in to comment.