allowHttp1 test
This commit is contained in:
parent
5ba849d9b1
commit
6a34a5462a
1 changed files with 8 additions and 1 deletions
|
@ -22,6 +22,7 @@ Stream<List<int>> jfkStream() {
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
var client = Http2Client();
|
var client = Http2Client();
|
||||||
|
var h1c = http.Client();
|
||||||
Angel app;
|
Angel app;
|
||||||
AngelHttp2 http2;
|
AngelHttp2 http2;
|
||||||
Uri serverRoot;
|
Uri serverRoot;
|
||||||
|
@ -97,7 +98,7 @@ void main() {
|
||||||
..usePrivateKey('dev.key', password: 'dartdart')
|
..usePrivateKey('dev.key', password: 'dartdart')
|
||||||
..setAlpnProtocols(['h2'], true);
|
..setAlpnProtocols(['h2'], true);
|
||||||
|
|
||||||
http2 = AngelHttp2(app, ctx);
|
http2 = AngelHttp2(app, ctx, allowHttp1: true);
|
||||||
|
|
||||||
var server = await http2.startServer();
|
var server = await http2.startServer();
|
||||||
serverRoot = Uri.parse('https://127.0.0.1:${server.port}');
|
serverRoot = Uri.parse('https://127.0.0.1:${server.port}');
|
||||||
|
@ -105,6 +106,7 @@ void main() {
|
||||||
|
|
||||||
tearDown(() async {
|
tearDown(() async {
|
||||||
await http2.close();
|
await http2.close();
|
||||||
|
await h1c.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('buffered response', () async {
|
test('buffered response', () async {
|
||||||
|
@ -112,6 +114,11 @@ void main() {
|
||||||
expect(response.body, 'Hello world');
|
expect(response.body, 'Hello world');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('allowHttp1', () async {
|
||||||
|
var response = await h1c.get(serverRoot);
|
||||||
|
expect(response.body, 'Hello world');
|
||||||
|
});
|
||||||
|
|
||||||
test('streamed response', () async {
|
test('streamed response', () async {
|
||||||
var response = await client.get(serverRoot.replace(path: '/stream'));
|
var response = await client.get(serverRoot.replace(path: '/stream'));
|
||||||
expect(response.body, jfk);
|
expect(response.body, jfk);
|
||||||
|
|
Loading…
Reference in a new issue