From 6a34a5462a36d74fb68f223b76692503c164d057 Mon Sep 17 00:00:00 2001 From: thosakwe Date: Wed, 17 Jul 2019 13:21:43 -0400 Subject: [PATCH] allowHttp1 test --- test/http2/adapter_test.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/http2/adapter_test.dart b/test/http2/adapter_test.dart index 701f985c..5d287a32 100644 --- a/test/http2/adapter_test.dart +++ b/test/http2/adapter_test.dart @@ -22,6 +22,7 @@ Stream> jfkStream() { void main() { var client = Http2Client(); + var h1c = http.Client(); Angel app; AngelHttp2 http2; Uri serverRoot; @@ -97,7 +98,7 @@ void main() { ..usePrivateKey('dev.key', password: 'dartdart') ..setAlpnProtocols(['h2'], true); - http2 = AngelHttp2(app, ctx); + http2 = AngelHttp2(app, ctx, allowHttp1: true); var server = await http2.startServer(); serverRoot = Uri.parse('https://127.0.0.1:${server.port}'); @@ -105,6 +106,7 @@ void main() { tearDown(() async { await http2.close(); + await h1c.close(); }); test('buffered response', () async { @@ -112,6 +114,11 @@ void main() { expect(response.body, 'Hello world'); }); + test('allowHttp1', () async { + var response = await h1c.get(serverRoot); + expect(response.body, 'Hello world'); + }); + test('streamed response', () async { var response = await client.get(serverRoot.replace(path: '/stream')); expect(response.body, jfk);