diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml
index 3cbc4924..568c7bb1 100644
--- a/.idea/libraries/Dart_Packages.xml
+++ b/.idea/libraries/Dart_Packages.xml
@@ -5,7 +5,14 @@
-
+
+
+
+
+
+
+
+
@@ -16,17 +23,10 @@
-
-
-
-
-
-
-
-
+
@@ -40,28 +40,28 @@
-
+
-
+
-
+
-
+
@@ -82,7 +82,7 @@
-
+
@@ -93,66 +93,59 @@
-
-
-
-
-
-
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -173,7 +166,7 @@
-
+
@@ -187,35 +180,21 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -229,49 +208,49 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -285,286 +264,267 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
-
-
+
-
-
-
-
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 37317968..d3b6f07a 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,8 +2,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -26,101 +55,95 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -137,9 +160,6 @@
- (req, res)
- headers: headers,
- _
ContentType.HTML.mimeType
ContentType.JSON.mimeType
parameters
@@ -167,9 +187,11 @@
==
as Map<String, dynamic>
result as Map<String, dynamic>
+ random_strin
+ Angel()
+ change
- JSON.decode
query
cookie
req.path
@@ -199,6 +221,7 @@
IsInstanceOf
[Iterable]
_foldStringDynamic(result)
+ Angel(MirrorsReflector())
C:\Users\thosa\Source\Angel\framework\lib
@@ -206,9 +229,9 @@
C:\Users\thosa\Source\Angel\framework\test
$PROJECT_DIR$/lib/src
$PROJECT_DIR$/lib/src/core
- $PROJECT_DIR$
$PROJECT_DIR$/lib
$PROJECT_DIR$/test
+ $PROJECT_DIR$
@@ -222,37 +245,16 @@
@@ -300,6 +323,8 @@
+
+
@@ -351,8 +376,6 @@
-
-
@@ -397,7 +420,7 @@
-
+
@@ -690,20 +713,8 @@
-
-
- 1517977060369
-
-
-
- 1517977060369
-
-
- 1517978048042
-
-
-
- 1517978048043
+
+
1517978306602
@@ -1034,13 +1045,24 @@
1533353912001
-
+
+ 1534547008912
+
+
+
+ 1534547008913
+
+
+ 1534547132671
+
+
+
+ 1534547132671
+
+
-
-
-
@@ -1068,9 +1090,12 @@
+
+
+
-
+
@@ -1082,7 +1107,7 @@
-
+
@@ -1101,28 +1126,28 @@
+
-
-
+
+
+
-
+
-
-
-
+
@@ -1133,7 +1158,6 @@
-
@@ -1158,7 +1182,8 @@
-
+
+
@@ -1166,128 +1191,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1337,20 +1241,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1358,34 +1248,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1445,7 +1307,7 @@
-
+
@@ -1455,7 +1317,7 @@
-
+
@@ -1472,25 +1334,247 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d3d8842f..aa3ccbfc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
-# 1.1.5+2
+# 2.0.0-alpha
* Removed `random_string` dependency.
+* Moved reflection to `package:angel_container`.
+* Upgraded `package:file` to `5.0.0`.
+* `ResponseContext.sendFile` now uses `package:file`.
+* Abandon `ContentType` in favor of `MediaType`.
# 1.1.5+1
* Patched annoying error that prevented MapServices from working,
diff --git a/README.md b/README.md
index d8276fba..95d45434 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ To build real-world applications, please see the [homepage](https://angel-dart.g
import 'package:angel_framework/angel_framework.dart';
main() async {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
// Index route. Returns JSON.
app.get('/', () => 'Welcome to Angel!');
diff --git a/example/handle_error.dart b/example/handle_error.dart
index 5b5b2d50..f8a4c9a3 100644
--- a/example/handle_error.dart
+++ b/example/handle_error.dart
@@ -1,10 +1,11 @@
import 'dart:async';
import 'dart:io';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:logging/logging.dart';
main() async {
- var app = new Angel()
+ var app = new Angel(MirrorsReflector())
..lazyParseBodies = true
..logger = (new Logger('angel')..onRecord.listen(print))
..encoders.addAll({'gzip': gzip.encoder});
diff --git a/example/json.dart b/example/json.dart
index 27426ba9..ce7e762a 100644
--- a/example/json.dart
+++ b/example/json.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:isolate';
import 'package:dart2_constant/convert.dart';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
main() async {
@@ -28,7 +29,7 @@ main() async {
}
serverMain(_) async {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
var http = new AngelHttp.custom(app, startShared); // Run a cluster
app.get('/', {
diff --git a/example/main.dart b/example/main.dart
index 1b5cca7f..9602570c 100644
--- a/example/main.dart
+++ b/example/main.dart
@@ -1,7 +1,8 @@
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
main() async {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
// Index route. Returns JSON.
app.get('/', () => 'Welcome to Angel!');
diff --git a/example/templating.dart b/example/templating.dart
index 728d65b1..a55ea0d5 100644
--- a/example/templating.dart
+++ b/example/templating.dart
@@ -1,4 +1,5 @@
import 'dart:io';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_jael/angel_jael.dart';
import 'package:file/local.dart';
@@ -6,7 +7,7 @@ import 'package:logging/logging.dart';
import 'package:path/path.dart' as p;
main() async {
- var app = new Angel()
+ var app = new Angel(MirrorsReflector())
..lazyParseBodies = true
..logger = (new Logger('angel')..onRecord.listen(print))
..encoders.addAll({'gzip': gzip.encoder});
diff --git a/example/view.dart b/example/view.dart
index 72cd14f9..dec27de8 100644
--- a/example/view.dart
+++ b/example/view.dart
@@ -1,7 +1,8 @@
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
main() async {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
app.viewGenerator = (name, [data]) async =>
'View generator invoked with name $name and data: $data';
diff --git a/lib/src/core/angel_base.dart b/lib/src/core/angel_base.dart
index bf055630..0d1f1745 100644
--- a/lib/src/core/angel_base.dart
+++ b/lib/src/core/angel_base.dart
@@ -1,7 +1,7 @@
library angel_framework.http.angel_base;
import 'dart:async';
-import 'package:container/container.dart';
+import 'package:angel_container/angel_container.dart';
import 'routable.dart';
/// A function that asynchronously generates a view from the given path and data.
@@ -12,7 +12,11 @@ class AngelBase extends Routable {
static ViewGenerator noViewEngineConfigured = (String view, [Map data]) =>
new Future.value("No view engine has been configured yet.");
- Container _container = new Container();
+ Container _container;
+
+ AngelBase(Reflector reflector) {
+ _container = new Container(reflector);
+ }
final Map configuration = {};
diff --git a/lib/src/core/response_context.dart b/lib/src/core/response_context.dart
index 19132f7a..7d94424c 100644
--- a/lib/src/core/response_context.dart
+++ b/lib/src/core/response_context.dart
@@ -2,9 +2,11 @@ library angel_framework.http.response_context;
import 'dart:async';
import 'dart:convert' show Converter, Encoding;
-import 'dart:io';
-import 'package:dart2_constant/convert.dart';
+import 'dart:io' show BytesBuilder, HttpResponse;
import 'package:angel_route/angel_route.dart';
+import 'package:dart2_constant/convert.dart';
+import 'package:file/file.dart';
+import 'package:http_parser/http_parser.dart';
import 'package:json_god/json_god.dart' as god;
import 'package:mime/mime.dart';
import 'package:pool/pool.dart';
@@ -102,26 +104,8 @@ abstract class ResponseContext implements StreamSink>, StringSink {
/// The underlying [HttpResponse] under this instance.
HttpResponse get io;
- /// Gets the Content-Type header.
- ContentType get contentType {
- if (!headers.containsKey('content-type')) return null;
-
- var header = headers['content-type'];
- var match = _contentType.firstMatch(header);
-
- if (match == null)
- throw new Exception('Malformed Content-Type response header: "$header".');
-
- if (match[4]?.isNotEmpty != true)
- return new ContentType(match[1], match[2]);
- else
- return new ContentType(match[1], match[2], charset: match[4]);
- }
-
- /// Sets the Content-Type header.
- void set contentType(ContentType contentType) {
- headers['content-type'] = contentType.toString();
- }
+ /// Gets or sets the content type to send back to a client.
+ MediaType contentType = new MediaType('text', 'plain');
/// Set this to true if you will manually close the response.
///
@@ -187,7 +171,7 @@ abstract class ResponseContext implements StreamSink>, StringSink {
void json(value) => serialize(value, contentType: 'application/json');
/// Returns a JSONP response.
- void jsonp(value, {String callbackName: "callback", contentType}) {
+ void jsonp(value, {String callbackName: "callback", MediaType contentType}) {
if (!isOpen) throw closed();
write("$callbackName(${serializer(value)})");
diff --git a/lib/src/core/server.dart b/lib/src/core/server.dart
index 063d4f8c..a143d8f6 100644
--- a/lib/src/core/server.dart
+++ b/lib/src/core/server.dart
@@ -4,10 +4,11 @@ import 'dart:async';
import 'dart:collection' show HashMap;
import 'dart:convert';
import 'dart:io';
+import 'package:angel_container/angel_container.dart';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_http_exception/angel_http_exception.dart';
import 'package:angel_route/angel_route.dart';
import 'package:combinator/combinator.dart';
-export 'package:container/container.dart';
import 'package:logging/logging.dart';
import 'package:tuple/tuple.dart';
import '../http/http.dart';
@@ -482,7 +483,7 @@ class Angel extends AngelBase {
}
/// Default constructor. ;)
- Angel() : super() {
+ Angel(Reflector reflector) : super(reflector) {
bootstrapContainer();
// ignore: deprecated_member_use
createZoneForRequest = defaultZoneCreator;
@@ -507,14 +508,14 @@ class Angel extends AngelBase {
@deprecated
factory Angel.custom(
Future Function(dynamic, int) serverGenerator) {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
return app.._http = new AngelHttp.custom(app, serverGenerator);
}
/// Use the serving methods in [AngelHttp] instead.
@deprecated
factory Angel.fromSecurityContext(SecurityContext context) {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
app._http = new AngelHttp.custom(app, (address, int port) {
return HttpServer.bindSecure(address, port, context);
@@ -527,7 +528,7 @@ class Angel extends AngelBase {
@deprecated
factory Angel.secure(String certificateChainPath, String serverKeyPath,
{String password}) {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
return app
.._http = new AngelHttp.secure(app, certificateChainPath, serverKeyPath,
password: password);
diff --git a/performance/hello/main.dart b/performance/hello/main.dart
index 73b69b35..3400e8b7 100644
--- a/performance/hello/main.dart
+++ b/performance/hello/main.dart
@@ -4,6 +4,7 @@ library performance.hello;
import 'dart:async';
import 'dart:io';
import 'dart:isolate';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
main() async {
@@ -22,7 +23,7 @@ main() async {
}
void start(int id) {
- var app = new Angel()..lazyParseBodies = true;
+ var app = new Angel(MirrorsReflector())..lazyParseBodies = true;
var http = new AngelHttp.custom(app, startShared, useZone: false);
app.get('/', (ResponseContext res) => res.write('Hello, world!'));
diff --git a/pubspec.yaml b/pubspec.yaml
index 09ebd2b2..b4731d0c 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,18 +1,18 @@
name: angel_framework
-version: 1.1.5+2
+version: 2.0.0-alpha
description: A high-powered HTTP server with DI, routing and more.
author: Tobe O
homepage: https://github.com/angel-dart/angel_framework
environment:
sdk: ">=1.8.0 <3.0.0"
dependencies:
+ angel_container: ^1.0.0-alpha
angel_http_exception: ^1.0.0
angel_model: ^1.0.0
angel_route: ^2.0.0
body_parser: ^1.0.0-dev
charcode: ^1.0.0
combinator: ">=1.0.0-beta <2.0.0"
- container: ^0.1.2
dart2_constant: ^1.0.0
http_parser: ^3.0.0
json_god: ^2.0.0-beta
@@ -26,9 +26,11 @@ dependencies:
stack_trace: ^1.0.0
tuple: ^1.0.0
dev_dependencies:
- angel_jael: ^1.0.0
- file: ^2.0.0
+ #angel_jael: ^1.0.0
+ file: ^5.0.0
http: ^0.11.3
io: ^0.3.0
mock_request: ^1.0.0
- test: ^0.12.13
+ test: ^1.0.0
+dependency_overrides:
+ file: ^5.0.0
\ No newline at end of file
diff --git a/test/accepts_test.dart b/test/accepts_test.dart
index 2fe4e6bc..caa6a2eb 100644
--- a/test/accepts_test.dart
+++ b/test/accepts_test.dart
@@ -1,4 +1,5 @@
import 'dart:async';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:mock_request/mock_request.dart';
import 'package:test/test.dart';
@@ -60,7 +61,7 @@ Future acceptContentTypes(
var rq = new MockHttpRequest('GET', ENDPOINT);
rq.headers.set('accept', headerString);
rq.close();
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
var http = new AngelHttp(app);
return http.createRequestContext(rq);
}
diff --git a/test/controller_test.dart b/test/controller_test.dart
index 12ff29d6..e90c4167 100644
--- a/test/controller_test.dart
+++ b/test/controller_test.dart
@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:io';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:dart2_constant/convert.dart';
import 'package:http/http.dart' as http;
@@ -42,7 +43,7 @@ main() {
String url;
setUp(() async {
- app = new Angel();
+ app = new Angel(MirrorsReflector());
app.requestMiddleware["foo"] = (req, res) async {
res.write("Hello, ");
return true;
@@ -76,7 +77,7 @@ main() {
test('require expose', () async {
try {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
await app.configure(new NoExposeController().configureServer);
throw 'Should require @Expose';
} on Exception {
@@ -85,7 +86,7 @@ main() {
});
test('create dynamic handler', () async {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
app.get(
'/foo',
createDynamicHandler(({String bar}) {
@@ -98,7 +99,7 @@ main() {
});
test('optional name', () async {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
await app.configure(new NamedController().configureServer);
expect(app.controllers['foo'], const IsInstanceOf());
});
diff --git a/test/di_test.dart b/test/di_test.dart
index db9db0c9..5138ac60 100644
--- a/test/di_test.dart
+++ b/test/di_test.dart
@@ -1,4 +1,5 @@
import 'dart:io';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:dart2_constant/convert.dart';
import 'package:http/http.dart' as http;
@@ -15,7 +16,7 @@ main() {
String url;
setUp(() async {
- app = new Angel();
+ app = new Angel(MirrorsReflector());
client = new http.Client();
// Inject some todos
diff --git a/test/encoders_buffer_test.dart b/test/encoders_buffer_test.dart
index 3a76eef7..1d52708e 100644
--- a/test/encoders_buffer_test.dart
+++ b/test/encoders_buffer_test.dart
@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:io' show BytesBuilder;
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:dart2_constant/convert.dart';
import 'package:dart2_constant/io.dart';
@@ -17,7 +18,7 @@ main() {
Angel app;
setUp(() {
- app = new Angel();
+ app = new Angel(MirrorsReflector());
app.injectEncoders(
{
'deflate': zlib.encoder,
diff --git a/test/extension_test.dart b/test/extension_test.dart
index 34a5f37f..f585e060 100644
--- a/test/extension_test.dart
+++ b/test/extension_test.dart
@@ -1,4 +1,5 @@
import 'dart:async';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:mock_request/mock_request.dart';
import 'package:test/test.dart';
@@ -24,7 +25,7 @@ main() {
Future makeRequest(String path) {
var rq = new MockHttpRequest('GET', ENDPOINT.replace(path: path))..close();
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
var http = new AngelHttp(app);
return http.createRequestContext(rq);
}
diff --git a/test/general_test.dart b/test/general_test.dart
index 36550b70..c04e9c31 100644
--- a/test/general_test.dart
+++ b/test/general_test.dart
@@ -1,4 +1,5 @@
import 'dart:io';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:dart2_constant/convert.dart';
import 'package:http/http.dart' as http;
@@ -11,7 +12,7 @@ main() {
String url;
setUp(() async {
- app = new Angel()
+ app = new Angel(MirrorsReflector())
..post('/foo', () => {'hello': 'world'})
..all('*', () => throw new AngelHttpException.notFound());
client = new http.Client();
diff --git a/test/hooked_test.dart b/test/hooked_test.dart
index 509dcd41..fb8ebacd 100644
--- a/test/hooked_test.dart
+++ b/test/hooked_test.dart
@@ -1,4 +1,5 @@
import 'dart:io';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:http/http.dart' as http;
import 'package:json_god/json_god.dart' as god;
@@ -18,7 +19,7 @@ main() {
HookedService Todos;
setUp(() async {
- app = new Angel();
+ app = new Angel(MirrorsReflector());
client = new http.Client();
app.use('/todos', new TypedService(new MapService()));
app.use('/books', new BookService());
diff --git a/test/parameter_meta_test.dart b/test/parameter_meta_test.dart
index c1460a33..c5d113f5 100644
--- a/test/parameter_meta_test.dart
+++ b/test/parameter_meta_test.dart
@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:io';
+import 'package:angel_container/mirrors.dart';
import 'package:dart2_constant/convert.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:mock_request/mock_request.dart';
@@ -27,7 +28,7 @@ parameterMetaTests() {
AngelHttp http;
setUp(() {
- app = new Angel()..lazyParseBodies = true;
+ app = new Angel(MirrorsReflector())..lazyParseBodies = true;
http = new AngelHttp(app);
app.get('/cookie', (@CookieValue('token') String jwt) {
diff --git a/test/precontained_test.dart b/test/precontained_test.dart
index 64a67096..299b4042 100644
--- a/test/precontained_test.dart
+++ b/test/precontained_test.dart
@@ -1,3 +1,4 @@
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:dart2_constant/convert.dart';
import 'package:mock_request/mock_request.dart';
@@ -5,7 +6,7 @@ import 'package:test/test.dart';
main() {
test('preinjects functions', () async {
- var app = new Angel()
+ var app = new Angel(MirrorsReflector())
..configuration['foo'] = 'bar'
..get('/foo', echoAppFoo);
app.optimizeForProduction(force: true);
diff --git a/test/primitives_test.dart b/test/primitives_test.dart
index 289eb533..c5988f55 100644
--- a/test/primitives_test.dart
+++ b/test/primitives_test.dart
@@ -1,4 +1,5 @@
import 'dart:io' show stderr;
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:dart2_constant/convert.dart';
import 'package:mock_request/mock_request.dart';
@@ -9,7 +10,7 @@ main() {
AngelHttp http;
setUp(() {
- app = new Angel()..inject('global', 305); // Pitbull!
+ app = new Angel(MirrorsReflector())..inject('global', 305); // Pitbull!
http = new AngelHttp(app);
app.get('/string/:string', (String string) => string);
diff --git a/test/repeat_request_test.dart b/test/repeat_request_test.dart
index 294066b4..ca7bc3bd 100644
--- a/test/repeat_request_test.dart
+++ b/test/repeat_request_test.dart
@@ -1,4 +1,5 @@
import 'dart:async';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:dart2_constant/convert.dart';
import 'package:mock_request/mock_request.dart';
@@ -10,7 +11,7 @@ main() {
}
test('can request the same url twice', () async {
- var app = new Angel()..get('/test/:id', (id) => 'Hello $id');
+ var app = new Angel(MirrorsReflector())..get('/test/:id', (id) => 'Hello $id');
var rq1 = mk(1), rq2 = mk(2), rq3 = mk(1);
await Future.wait([rq1, rq2, rq3].map(new AngelHttp(app).handleRequest));
var body1 = await rq1.response.transform(utf8.decoder).join(),
diff --git a/test/routing_test.dart b/test/routing_test.dart
index 039ce799..cb624317 100644
--- a/test/routing_test.dart
+++ b/test/routing_test.dart
@@ -1,4 +1,5 @@
import 'dart:io';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:dart2_constant/convert.dart';
import 'package:http/http.dart' as http;
@@ -27,9 +28,9 @@ main() {
http.Client client;
setUp(() async {
- app = new Angel();
- nested = new Angel();
- todos = new Angel();
+ app = new Angel(MirrorsReflector());
+ nested = new Angel(MirrorsReflector());
+ todos = new Angel(MirrorsReflector());
// Lazy-parse in production
[app, nested, todos].forEach((Angel app) {
diff --git a/test/serialize_test.dart b/test/serialize_test.dart
index 24929afb..2e027d30 100644
--- a/test/serialize_test.dart
+++ b/test/serialize_test.dart
@@ -1,4 +1,5 @@
import 'dart:io';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:http/http.dart' as http;
import 'package:test/test.dart';
@@ -10,7 +11,7 @@ main() {
String url;
setUp(() async {
- app = new Angel()
+ app = new Angel(MirrorsReflector())
..get('/foo', () => {'hello': 'world'})
..get(
'/bar',
diff --git a/test/server_test.dart b/test/server_test.dart
index 7c450f81..8c1ca114 100644
--- a/test/server_test.dart
+++ b/test/server_test.dart
@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:io';
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:dart2_constant/convert.dart';
import 'package:matcher/matcher.dart';
@@ -11,8 +12,8 @@ final Uri $foo = Uri.parse('http://localhost:3000/foo');
/// Additional tests to improve coverage of server.dart
main() {
group('scoping', () {
- var parent = new Angel()..configuration['two'] = 2;
- var child = new Angel();
+ var parent = new Angel(MirrorsReflector())..configuration['two'] = 2;
+ var child = new Angel(MirrorsReflector());
parent.use('/child', child);
test('sets children', () {
@@ -29,13 +30,13 @@ main() {
});
test('custom server generator', () {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
var http = new AngelHttp.custom(app, HttpServer.bind);
expect(http.serverGenerator, HttpServer.bind);
});
test('default error handler', () async {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
var http = new AngelHttp(app);
var rq = new MockHttpRequest('GET', $foo);
rq.close();
@@ -58,7 +59,7 @@ main() {
});
test('plug-ins run on startup', () async {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
app.startupHooks.add((app) => app.configuration['two'] = 2);
var http = new AngelHttp(app);
@@ -69,14 +70,14 @@ main() {
});
test('warning when adding routes to flattened router', () {
- var app = new Angel()..optimizeForProduction(force: true);
+ var app = new Angel(MirrorsReflector())..optimizeForProduction(force: true);
app.dumpTree();
app.get('/', () => 2);
app.mount('/foo', new Router()..get('/', 3));
});
test('services close on close call', () async {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
var svc = new CustomCloseService();
expect(svc.value, 2);
app.use('/', svc);
@@ -85,7 +86,7 @@ main() {
});
test('global injection added to injection map', () async {
- var app = new Angel()..inject('a', 'b');
+ var app = new Angel(MirrorsReflector())..inject('a', 'b');
var http = new AngelHttp(app);
app.get('/', (String a) => a);
var rq = new MockHttpRequest('GET', Uri.parse('/'))..close();
@@ -95,7 +96,7 @@ main() {
});
test('global injected serializer', () async {
- var app = new Angel()..serializer = (_) => 'x';
+ var app = new Angel(MirrorsReflector())..serializer = (_) => 'x';
var http = new AngelHttp(app);
app.get($foo.path, (req, ResponseContext res) => res.serialize(null));
var rq = new MockHttpRequest('GET', $foo)..close();
@@ -105,7 +106,7 @@ main() {
});
group('handler results', () {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
var http = new AngelHttp(app);
app.responseFinalizers
.add((req, res) => throw new AngelHttpException.forbidden());
@@ -151,7 +152,7 @@ main() {
AngelHttp http;
setUp(() async {
- app = new Angel();
+ app = new Angel(MirrorsReflector());
app.get('/wtf', () => throw new AngelHttpException.forbidden());
app.get('/wtf2', () => throw new AngelHttpException.forbidden());
http = new AngelHttp(app);
diff --git a/test/services_test.dart b/test/services_test.dart
index 9f09f523..3a5cdd99 100644
--- a/test/services_test.dart
+++ b/test/services_test.dart
@@ -1,3 +1,4 @@
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:dart2_constant/convert.dart';
import 'package:http/http.dart' as http;
@@ -20,7 +21,7 @@ main() {
http.Client client;
setUp(() async {
- app = new Angel()
+ app = new Angel(MirrorsReflector())
..use('/todos', new TypedService(new MapService()))
..errorHandler = (e, req, res) {
print('Whoops: ${e.error}');
diff --git a/test/streaming_test.dart b/test/streaming_test.dart
index f6b86091..1b65e9be 100644
--- a/test/streaming_test.dart
+++ b/test/streaming_test.dart
@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:io' show stderr;
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:dart2_constant/convert.dart';
import 'package:dart2_constant/io.dart';
@@ -13,7 +14,7 @@ main() {
AngelHttp http;
setUp(() {
- app = new Angel();
+ app = new Angel(MirrorsReflector());
http = new AngelHttp(app);
app.logger = new Logger('streaming_test')
diff --git a/test/view_generator_test.dart b/test/view_generator_test.dart
index 177fb63f..a886edb6 100644
--- a/test/view_generator_test.dart
+++ b/test/view_generator_test.dart
@@ -1,9 +1,10 @@
+import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:test/test.dart';
main() {
test('default view generator', () async {
- var app = new Angel();
+ var app = new Angel(MirrorsReflector());
var view = await app.viewGenerator('foo', {'bar': 'baz'});
expect(view, contains('No view engine'));
});