Ensure Dart 1 compat

This commit is contained in:
Tobe O 2018-07-09 12:21:14 -04:00
parent 046c1f7807
commit 525e72c510
4 changed files with 8 additions and 6 deletions

View file

@ -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({

View file

@ -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<List<int>> 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,

View file

@ -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);

View file

@ -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'));
});