Skip to content

Commit 9f022d2

Browse files
authored
pkgs/http_client_conformance_tests: add boolean flag supportsFoldedHeaders (#1222)
1 parent 90837df commit 9f022d2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

pkgs/http_client_conformance_tests/lib/http_client_conformance_tests.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export 'src/server_errors_test.dart' show testServerErrors;
6464
/// If [canReceiveSetCookieHeaders] is `false` then tests that require that
6565
/// "set-cookie" headers be received by the client will not be run.
6666
///
67+
/// If [supportsFoldedHeaders] is `false` then the tests that assume that the
68+
/// [Client] can parse folded headers will be skipped.
69+
///
6770
/// The tests are run against a series of HTTP servers that are started by the
6871
/// tests. If the tests are run in the browser, then the test servers are
6972
/// started in another process. Otherwise, the test servers are run in-process.
@@ -74,6 +77,7 @@ void testAll(
7477
bool redirectAlwaysAllowed = false,
7578
bool canWorkInIsolates = true,
7679
bool preservesMethodCase = false,
80+
bool supportsFoldedHeaders = true,
7781
bool canSendCookieHeaders = false,
7882
bool canReceiveSetCookieHeaders = false,
7983
}) {
@@ -86,7 +90,8 @@ void testAll(
8690
canStreamResponseBody: canStreamResponseBody);
8791
testRequestHeaders(clientFactory());
8892
testRequestMethods(clientFactory(), preservesMethodCase: preservesMethodCase);
89-
testResponseHeaders(clientFactory());
93+
testResponseHeaders(clientFactory(),
94+
supportsFoldedHeaders: supportsFoldedHeaders);
9095
testResponseStatusLine(clientFactory());
9196
testRedirect(clientFactory(), redirectAlwaysAllowed: redirectAlwaysAllowed);
9297
testServerErrors(clientFactory());

pkgs/http_client_conformance_tests/lib/src/response_headers_tests.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import 'response_headers_server_vm.dart'
1111
if (dart.library.js_interop) 'response_headers_server_web.dart';
1212

1313
/// Tests that the [Client] correctly processes response headers.
14-
void testResponseHeaders(Client client) async {
14+
void testResponseHeaders(Client client,
15+
{bool supportsFoldedHeaders = true}) async {
1516
group('server headers', () {
1617
late String host;
1718
late StreamChannel<Object?> httpServerChannel;
@@ -177,6 +178,8 @@ void testResponseHeaders(Client client) async {
177178
allOf(matches(RegExp(r'BAR {0,3}[ \t]? {0,7}[ \t]? {0,3}BAZ')),
178179
contains(' ')));
179180
});
180-
});
181+
},
182+
skip:
183+
!supportsFoldedHeaders ? 'does not support folded headers' : false);
181184
});
182185
}

0 commit comments

Comments
 (0)