diff --git a/example/main.dart b/example/main.dart index ed8bb393..c5a811a8 100644 --- a/example/main.dart +++ b/example/main.dart @@ -1,8 +1,8 @@ -import 'dart:io'; import 'package:angel_framework/angel_framework.dart'; import 'package:angel_test/angel_test.dart'; import 'package:angel_validate/angel_validate.dart'; import 'package:angel_websocket/server.dart'; +import 'package:dart2_constant/io.dart'; import 'package:test/test.dart'; main() { @@ -97,7 +97,6 @@ main() { test('hasValidBody+hasContentType', () async { var res = await client.get('/valid'); expect(res, hasContentType('application/json')); - expect(res, hasContentType(new ContentType('application', 'json'))); expect( res, hasValidBody(new Validator({ diff --git a/lib/src/client.dart b/lib/src/client.dart index 563fa89b..5540111f 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -1,6 +1,6 @@ import 'dart:async'; import 'dart:convert' show Encoding; -import 'dart:io' show ContentType, Cookie, HttpSession, HttpServer, WebSocket; +import 'dart:io' show ContentType, Cookie, HttpServer, HttpSession, WebSocket; import 'package:dart2_constant/convert.dart'; import 'package:dart2_constant/io.dart' hide WebSocket; import 'package:angel_client/base_angel_client.dart' as client; @@ -138,8 +138,9 @@ class TestClient extends client.BaseAngelClient { Stream> stream = rs; if (autoDecodeGzip != false && - rs.headers['content-encoding']?.contains('gzip') == true) + rs.headers['content-encoding']?.contains('gzip') == true) { stream = stream.transform(gzip.decoder); + } return new StreamedResponse(stream, rs.statusCode, contentLength: rs.contentLength, diff --git a/lib/src/matchers.dart b/lib/src/matchers.dart index 16c09630..fc0f62a7 100644 --- a/lib/src/matchers.dart +++ b/lib/src/matchers.dart @@ -133,7 +133,7 @@ class _HasHeader extends Matcher { .matches(item.headers.keys, matchState); } else { if (!item.headers.containsKey(key.toLowerCase())) return false; - Iterable v = value is Iterable ? value : [value]; + Iterable v = value is Iterable ? (value as Iterable) : [value]; return v .map((x) => x.toString()) .every(item.headers[key.toLowerCase()].split(',').contains); diff --git a/test/simple_test.dart b/test/simple_test.dart index fd96f841..2f3e5f11 100644 --- a/test/simple_test.dart +++ b/test/simple_test.dart @@ -1,8 +1,9 @@ -import 'dart:io'; +import 'dart:io' show ContentType; import 'package:angel_framework/angel_framework.dart'; import 'package:angel_test/angel_test.dart'; import 'package:angel_validate/angel_validate.dart'; import 'package:angel_websocket/server.dart'; +import 'package:dart2_constant/io.dart'; import 'package:test/test.dart'; main() { @@ -112,6 +113,7 @@ main() { test('gzip decode', () async { var res = await client.get('/gzip'); + print('Body: ${res.body}'); expect(res, hasHeader('content-encoding', 'gzip')); expect(res, hasBody('Poop')); });