+5
This commit is contained in:
parent
b1c4529b84
commit
5d851b6cde
37 changed files with 628 additions and 757 deletions
|
@ -5,7 +5,7 @@
|
||||||
<entry key="analyzer">
|
<entry key="analyzer">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/analyzer-0.31.1/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/analyzer-0.32.1/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
<entry key="angel_route">
|
<entry key="angel_route">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_route-2.0.5/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_route-2.0.7/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -51,13 +51,6 @@
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="barback">
|
|
||||||
<value>
|
|
||||||
<list>
|
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/barback-0.15.2+16/lib" />
|
|
||||||
</list>
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
<entry key="body_parser">
|
<entry key="body_parser">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
|
@ -79,13 +72,6 @@
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="cli_util">
|
|
||||||
<value>
|
|
||||||
<list>
|
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/cli_util-0.1.2+1/lib" />
|
|
||||||
</list>
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
<entry key="code_buffer">
|
<entry key="code_buffer">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
|
@ -96,14 +82,14 @@
|
||||||
<entry key="collection">
|
<entry key="collection">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/collection-1.14.9/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/collection-1.14.10/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="combinator">
|
<entry key="combinator">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/combinator-1.0.0-beta+7/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/combinator-1.0.0+3/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -124,7 +110,7 @@
|
||||||
<entry key="crypto">
|
<entry key="crypto">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/crypto-2.0.3/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/crypto-2.0.5/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -152,21 +138,21 @@
|
||||||
<entry key="front_end">
|
<entry key="front_end">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.0-alpha.9/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.1/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="glob">
|
<entry key="glob">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/glob-1.1.5/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/glob-1.1.6/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="html">
|
<entry key="html">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/html-0.13.3/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/html-0.13.3+1/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -180,7 +166,7 @@
|
||||||
<entry key="http_multi_server">
|
<entry key="http_multi_server">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.4/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.5/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -212,13 +198,6 @@
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="isolate">
|
|
||||||
<value>
|
|
||||||
<list>
|
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/isolate-1.1.0/lib" />
|
|
||||||
</list>
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
<entry key="jael">
|
<entry key="jael">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
|
@ -243,14 +222,21 @@
|
||||||
<entry key="json_god">
|
<entry key="json_god">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_god-2.0.0-beta+1/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_god-2.0.0-beta+2/lib" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="json_rpc_2">
|
||||||
|
<value>
|
||||||
|
<list>
|
||||||
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_rpc_2-2.0.8/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="kernel">
|
<entry key="kernel">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.0-alpha.9/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.1/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -264,7 +250,7 @@
|
||||||
<entry key="matcher">
|
<entry key="matcher">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.2+1/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -306,7 +292,7 @@
|
||||||
<entry key="node_preamble">
|
<entry key="node_preamble">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.1/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.2/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -320,14 +306,14 @@
|
||||||
<entry key="package_resolver">
|
<entry key="package_resolver">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_resolver-1.0.2/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_resolver-1.0.3/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="path">
|
<entry key="path">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/path-1.5.1/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/path-1.6.1/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -341,7 +327,7 @@
|
||||||
<entry key="pool">
|
<entry key="pool">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pool-1.3.4/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pool-1.3.5/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -369,7 +355,7 @@
|
||||||
<entry key="shelf">
|
<entry key="shelf">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.3/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.3+1/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -383,14 +369,14 @@
|
||||||
<entry key="shelf_static">
|
<entry key="shelf_static">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.7/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.7+1/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="shelf_web_socket">
|
<entry key="shelf_web_socket">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2+1/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2+2/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -425,7 +411,7 @@
|
||||||
<entry key="stream_channel">
|
<entry key="stream_channel">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.6/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.7+1/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -453,7 +439,7 @@
|
||||||
<entry key="test">
|
<entry key="test">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test-0.12.36/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test-0.12.42/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -478,101 +464,107 @@
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry key="vm_service_client">
|
||||||
|
<value>
|
||||||
|
<list>
|
||||||
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/vm_service_client-0.2.4+3/lib" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
<entry key="watcher">
|
<entry key="watcher">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+7/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+8/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="web_socket_channel">
|
<entry key="web_socket_channel">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.0.7/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.0.8/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="yaml">
|
<entry key="yaml">
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.13/lib" />
|
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.14/lib" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
</option>
|
</option>
|
||||||
</properties>
|
</properties>
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/analyzer-0.31.1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/analyzer-0.32.1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_http_exception-1.0.0/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_http_exception-1.0.0/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_jael-1.0.1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_jael-1.0.1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_model-1.0.0/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_model-1.0.0/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_route-2.0.5/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_route-2.0.7/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/args-1.4.3/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/args-1.4.3/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/async-2.0.7/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/async-2.0.7/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/barback-0.15.2+16/lib" />
|
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/body_parser-1.1.0/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/body_parser-1.1.0/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.3/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.3/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/cli_util-0.1.2+1/lib" />
|
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/code_buffer-1.0.0/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/code_buffer-1.0.0/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/collection-1.14.9/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/collection-1.14.10/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/combinator-1.0.0-beta+7/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/combinator-1.0.0+3/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/container-0.1.2/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/container-0.1.2/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/convert-2.0.1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/convert-2.0.1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/crypto-2.0.3/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/crypto-2.0.5/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/csslib-0.14.4/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/csslib-0.14.4/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/dart2_constant-1.0.1+dart2/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/dart2_constant-1.0.1+dart2/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/file-2.3.7/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/file-2.3.7/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.0-alpha.9/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/glob-1.1.5/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/glob-1.1.6/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/html-0.13.3/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/html-0.13.3+1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http-0.11.3+16/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http-0.11.3+16/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.4/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.5/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.2/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.2/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_server-0.9.7/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_server-0.9.7/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/intl-0.15.6/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/intl-0.15.6/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/io-0.3.2+1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/io-0.3.2+1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/isolate-1.1.0/lib" />
|
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/jael-1.0.4/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/jael-1.0.4/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/jael_preprocessor-1.0.0+1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/jael_preprocessor-1.0.0+1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/js-0.6.1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/js-0.6.1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_god-2.0.0-beta+1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_god-2.0.0-beta+2/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.0-alpha.9/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_rpc_2-2.0.8/lib" />
|
||||||
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.2+1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/merge_map-1.0.0/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/merge_map-1.0.0/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/meta-1.1.5/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/meta-1.1.5/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/mime-0.9.6+1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/mime-0.9.6+1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/mock_request-1.0.3/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/mock_request-1.0.3/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/multi_server_socket-1.0.1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/multi_server_socket-1.0.1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.2/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_config-1.0.3/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_config-1.0.3/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_resolver-1.0.2/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_resolver-1.0.3/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/path-1.5.1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/path-1.6.1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/plugin-0.2.0+2/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/plugin-0.2.0+2/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pool-1.3.4/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pool-1.3.5/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/quiver_hashcode-1.0.0/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/quiver_hashcode-1.0.0/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/random_string-0.0.1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/random_string-0.0.1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.3/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.3+1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-1.0.3/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-1.0.3/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.7/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.7+1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2+1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2+2/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_map_stack_trace-1.1.4/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_map_stack_trace-1.1.4/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_maps-0.10.5/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_maps-0.10.5/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_span-1.4.0/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_span-1.4.0/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.2/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.2/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.6/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.7+1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.2/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.2/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/symbol_table-1.0.4/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/symbol_table-1.0.4/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.0.0/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.0.0/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test-0.12.36/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test-0.12.42/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/tuple-1.0.1/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/tuple-1.0.1/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.5/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.5/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/utf-0.9.0+4/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/utf-0.9.0+4/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+7/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/vm_service_client-0.2.4+3/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.0.7/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+8/lib" />
|
||||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.13/lib" />
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.0.8/lib" />
|
||||||
|
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.14/lib" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<LIBRARY_FILE />
|
<LIBRARY_FILE />
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,8 @@
|
||||||
|
# 1.1.4+5
|
||||||
|
* Intermediary release while patching up Dart 2 bugs.
|
||||||
|
* Stricter Dart 2 use.
|
||||||
|
* Remove `AngelMetrics` for good.
|
||||||
|
|
||||||
# 1.1.4+4
|
# 1.1.4+4
|
||||||
* Fix a bug that caused a race condition in hooked services.
|
* Fix a bug that caused a race condition in hooked services.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
analyzer:
|
analyzer:
|
||||||
strong-mode: true
|
strong-mode:
|
||||||
|
implicit-casts: false
|
||||||
linter:
|
linter:
|
||||||
rules:
|
rules:
|
||||||
- avoid_slow_async_io
|
- avoid_slow_async_io
|
|
@ -141,12 +141,12 @@ HookedServiceEventListener remove(key, [remover(key, obj)]) {
|
||||||
else if (obj is List)
|
else if (obj is List)
|
||||||
return obj..remove(key);
|
return obj..remove(key);
|
||||||
else if (obj is Iterable)
|
else if (obj is Iterable)
|
||||||
return obj.where((k) => !key);
|
return obj.where((k) => key != true);
|
||||||
else if (obj is Map)
|
else if (obj is Map)
|
||||||
return obj..remove(key);
|
return obj..remove(key);
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
reflect(obj).setField(new Symbol(key), null);
|
reflect(obj).setField(new Symbol(key.toString()), null);
|
||||||
return obj;
|
return obj;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new ArgumentError("Cannot remove key '$key' from $obj.");
|
throw new ArgumentError("Cannot remove key '$key' from $obj.");
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
export 'src/stats/metric_server.dart';
|
|
||||||
export 'src/stats/stats.dart';
|
|
|
@ -5,15 +5,17 @@ import 'service.dart';
|
||||||
///
|
///
|
||||||
/// Well-suited for testing.
|
/// Well-suited for testing.
|
||||||
class AnonymousService extends Service {
|
class AnonymousService extends Service {
|
||||||
Function _index, _read, _create, _modify, _update, _remove;
|
Future Function([Map]) _index;
|
||||||
|
Future Function(Object, [Map]) _read, _create, _remove;
|
||||||
|
Future Function(Object, Object, [Map]) _modify, _update;
|
||||||
|
|
||||||
AnonymousService(
|
AnonymousService(
|
||||||
{FutureOr index([Map params]),
|
{Future index([Map params]),
|
||||||
FutureOr read(id, [Map params]),
|
Future read(id, [Map params]),
|
||||||
FutureOr create(data, [Map params]),
|
Future create(data, [Map params]),
|
||||||
FutureOr modify(id, data, [Map params]),
|
Future modify(id, data, [Map params]),
|
||||||
FutureOr update(id, data, [Map params]),
|
Future update(id, data, [Map params]),
|
||||||
FutureOr remove(id, [Map params])})
|
Future remove(id, [Map params])})
|
||||||
: super() {
|
: super() {
|
||||||
_index = index;
|
_index = index;
|
||||||
_read = read;
|
_read = read;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
library angel_framework.http;
|
library angel_framework.http;
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:angel_http_exception/angel_http_exception.dart';
|
|
||||||
import 'package:merge_map/merge_map.dart';
|
|
||||||
import '../util.dart';
|
import '../util.dart';
|
||||||
import 'request_context.dart';
|
import 'request_context.dart';
|
||||||
import 'response_context.dart';
|
import 'response_context.dart';
|
||||||
|
@ -48,12 +46,12 @@ class HookedService extends Service {
|
||||||
|
|
||||||
RequestContext _getRequest(Map params) {
|
RequestContext _getRequest(Map params) {
|
||||||
if (params == null) return null;
|
if (params == null) return null;
|
||||||
return params['__requestctx'];
|
return params['__requestctx'] as RequestContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResponseContext _getResponse(Map params) {
|
ResponseContext _getResponse(Map params) {
|
||||||
if (params == null) return null;
|
if (params == null) return null;
|
||||||
return params['__responsectx'];
|
return params['__responsectx'] as ResponseContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map _stripReq(Map params) {
|
Map _stripReq(Map params) {
|
||||||
|
@ -88,8 +86,7 @@ class HookedService extends Service {
|
||||||
/// Adds hooks to this instance.
|
/// Adds hooks to this instance.
|
||||||
void addHooks() {
|
void addHooks() {
|
||||||
Hooks hooks = getAnnotation(inner, Hooks);
|
Hooks hooks = getAnnotation(inner, Hooks);
|
||||||
final before = [];
|
List<HookedServiceEventListener> before = [], after = [];
|
||||||
final after = [];
|
|
||||||
|
|
||||||
if (hooks != null) {
|
if (hooks != null) {
|
||||||
before.addAll(hooks.before);
|
before.addAll(hooks.before);
|
||||||
|
@ -99,7 +96,8 @@ class HookedService extends Service {
|
||||||
void applyListeners(Function fn, HookedServiceEventDispatcher dispatcher,
|
void applyListeners(Function fn, HookedServiceEventDispatcher dispatcher,
|
||||||
[bool isAfter]) {
|
[bool isAfter]) {
|
||||||
Hooks hooks = getAnnotation(fn, Hooks);
|
Hooks hooks = getAnnotation(fn, Hooks);
|
||||||
final listeners = []..addAll(isAfter == true ? after : before);
|
final listeners = <HookedServiceEventListener>[]
|
||||||
|
..addAll(isAfter == true ? after : before);
|
||||||
|
|
||||||
if (hooks != null)
|
if (hooks != null)
|
||||||
listeners.addAll(isAfter == true ? hooks.after : hooks.before);
|
listeners.addAll(isAfter == true ? hooks.after : hooks.before);
|
||||||
|
|
|
@ -5,7 +5,7 @@ const List<Type> _primitiveTypes = const [String, int, num, double, Null];
|
||||||
/// Shortcut for calling [preInject], and then [handleContained].
|
/// Shortcut for calling [preInject], and then [handleContained].
|
||||||
///
|
///
|
||||||
/// Use this to instantly create a request handler for a DI-enabled method.
|
/// Use this to instantly create a request handler for a DI-enabled method.
|
||||||
RequestHandler createDynamicHandler(handler,
|
RequestHandler createDynamicHandler(Function handler,
|
||||||
{Iterable<String> optional: const []}) {
|
{Iterable<String> optional: const []}) {
|
||||||
var injection = preInject(handler);
|
var injection = preInject(handler);
|
||||||
injection.optional.addAll(optional ?? []);
|
injection.optional.addAll(optional ?? []);
|
||||||
|
@ -77,7 +77,7 @@ bool suitableForInjection(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles a request with a DI-enabled handler.
|
/// Handles a request with a DI-enabled handler.
|
||||||
RequestHandler handleContained(handler, InjectionRequest injection) {
|
RequestHandler handleContained(Function handler, InjectionRequest injection) {
|
||||||
return (RequestContext req, ResponseContext res) {
|
return (RequestContext req, ResponseContext res) {
|
||||||
if (injection.parameters.isNotEmpty &&
|
if (injection.parameters.isNotEmpty &&
|
||||||
injection.parameters.values.any((p) => p.match != null) &&
|
injection.parameters.values.any((p) => p.match != null) &&
|
||||||
|
|
|
@ -77,7 +77,7 @@ class MapService extends Service {
|
||||||
message:
|
message:
|
||||||
'MapService does not support `create` with ${data.runtimeType}.');
|
'MapService does not support `create` with ${data.runtimeType}.');
|
||||||
var now = new DateTime.now().toIso8601String();
|
var now = new DateTime.now().toIso8601String();
|
||||||
var result = data;
|
var result = data as Map;
|
||||||
|
|
||||||
if (autoIdAndDateFields == true) {
|
if (autoIdAndDateFields == true) {
|
||||||
result
|
result
|
||||||
|
@ -85,7 +85,7 @@ class MapService extends Service {
|
||||||
..[autoSnakeCaseNames == false ? 'createdAt' : 'created_at'] = now
|
..[autoSnakeCaseNames == false ? 'createdAt' : 'created_at'] = now
|
||||||
..[autoSnakeCaseNames == false ? 'updatedAt' : 'updated_at'] = now;
|
..[autoSnakeCaseNames == false ? 'updatedAt' : 'updated_at'] = now;
|
||||||
}
|
}
|
||||||
items.add(result);
|
items.add(result.cast<String, dynamic>());
|
||||||
return new Future.value(result);
|
return new Future.value(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class MapService extends Service {
|
||||||
if (!items.any(_matchesId(id))) return create(data, params);
|
if (!items.any(_matchesId(id))) return create(data, params);
|
||||||
|
|
||||||
return read(id).then((item) {
|
return read(id).then((item) {
|
||||||
var result = item..addAll(data);
|
var result = item..addAll(data as Map);
|
||||||
|
|
||||||
if (autoIdAndDateFields == true)
|
if (autoIdAndDateFields == true)
|
||||||
result
|
result
|
||||||
|
@ -121,7 +121,7 @@ class MapService extends Service {
|
||||||
throw new AngelHttpException.notFound(
|
throw new AngelHttpException.notFound(
|
||||||
message: 'No record found for ID $id');
|
message: 'No record found for ID $id');
|
||||||
|
|
||||||
var result = data;
|
var result = data as Map;
|
||||||
if (autoIdAndDateFields == true) {
|
if (autoIdAndDateFields == true) {
|
||||||
result
|
result
|
||||||
..['id'] = id?.toString()
|
..['id'] = id?.toString()
|
||||||
|
@ -130,7 +130,7 @@ class MapService extends Service {
|
||||||
..[autoSnakeCaseNames == false ? 'updatedAt' : 'updated_at'] =
|
..[autoSnakeCaseNames == false ? 'updatedAt' : 'updated_at'] =
|
||||||
new DateTime.now().toIso8601String();
|
new DateTime.now().toIso8601String();
|
||||||
}
|
}
|
||||||
items.add(result);
|
items.add(result.cast<String, dynamic>());
|
||||||
return new Future.value(result);
|
return new Future.value(result);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,18 +144,18 @@ abstract class RequestContext {
|
||||||
/// within a service hook.
|
/// within a service hook.
|
||||||
T grab<T>(key) {
|
T grab<T>(key) {
|
||||||
if (params.containsKey(key))
|
if (params.containsKey(key))
|
||||||
return params[key];
|
return params[key] as T;
|
||||||
else if (_injections.containsKey(key))
|
else if (_injections.containsKey(key))
|
||||||
return _injections[key];
|
return _injections[key] as T;
|
||||||
else if (properties.containsKey(key))
|
else if (properties.containsKey(key))
|
||||||
return properties[key];
|
return properties[key] as T;
|
||||||
else {
|
else {
|
||||||
var prop = app?.findProperty(key);
|
var prop = app?.findProperty(key);
|
||||||
if (prop != null)
|
if (prop != null)
|
||||||
return prop;
|
return prop as T;
|
||||||
else if (key is Type) {
|
else if (key is Type) {
|
||||||
try {
|
try {
|
||||||
return app.container.make(key);
|
return app.container.make(key) as T;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ abstract class RequestContext {
|
||||||
throw new ArgumentError(
|
throw new ArgumentError(
|
||||||
'RequestContext.accepts expects the `contentType` parameter to NOT be null.');
|
'RequestContext.accepts expects the `contentType` parameter to NOT be null.');
|
||||||
|
|
||||||
_acceptHeaderCache ??= headers.value(HttpHeaders.ACCEPT);
|
_acceptHeaderCache ??= headers.value('accept');
|
||||||
|
|
||||||
if (_acceptHeaderCache == null)
|
if (_acceptHeaderCache == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -179,7 +179,7 @@ abstract class ResponseContext implements StreamSink<List<int>>, StringSink {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Serializes JSON to the response.
|
/// Serializes JSON to the response.
|
||||||
void json(value) => serialize(value, contentType: ContentType.JSON);
|
void json(value) => serialize(value, contentType: 'application/json');
|
||||||
|
|
||||||
/// Returns a JSONP response.
|
/// Returns a JSONP response.
|
||||||
void jsonp(value, {String callbackName: "callback", contentType}) {
|
void jsonp(value, {String callbackName: "callback", contentType}) {
|
||||||
|
@ -202,7 +202,7 @@ abstract class ResponseContext implements StreamSink<List<int>>, StringSink {
|
||||||
if (!isOpen) throw closed();
|
if (!isOpen) throw closed();
|
||||||
return app.viewGenerator(view, data).then((content) {
|
return app.viewGenerator(view, data).then((content) {
|
||||||
write(content);
|
write(content);
|
||||||
headers['content-type'] = ContentType.HTML.toString();
|
headers['content-type'] = 'text/html';
|
||||||
end();
|
end();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -217,9 +217,9 @@ abstract class ResponseContext implements StreamSink<List<int>>, StringSink {
|
||||||
void redirect(url, {bool absolute: true, int code: 302}) {
|
void redirect(url, {bool absolute: true, int code: 302}) {
|
||||||
if (!isOpen) throw closed();
|
if (!isOpen) throw closed();
|
||||||
headers
|
headers
|
||||||
..['content-type'] = ContentType.HTML.toString()
|
..['content-type'] = 'text/html'
|
||||||
..['location'] =
|
..['location'] =
|
||||||
url is String ? url : app.navigate(url, absolute: absolute);
|
url is String ? url : app.navigate(url as Iterable, absolute: absolute);
|
||||||
statusCode = code ?? 302;
|
statusCode = code ?? 302;
|
||||||
write('''
|
write('''
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
@ -259,7 +259,7 @@ abstract class ResponseContext implements StreamSink<List<int>>, StringSink {
|
||||||
Route matched = _findRoute(app);
|
Route matched = _findRoute(app);
|
||||||
|
|
||||||
if (matched != null) {
|
if (matched != null) {
|
||||||
redirect(matched.makeUri(params), code: code);
|
redirect(matched.makeUri(params.cast<String, dynamic>()), code: code);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ abstract class ResponseContext implements StreamSink<List<int>>, StringSink {
|
||||||
|
|
||||||
final head =
|
final head =
|
||||||
controller.findExpose().path.toString().replaceAll(_straySlashes, '');
|
controller.findExpose().path.toString().replaceAll(_straySlashes, '');
|
||||||
final tail = matched.makeUri(params).replaceAll(_straySlashes, '');
|
final tail = matched.makeUri(params.cast<String, dynamic>()).replaceAll(_straySlashes, '');
|
||||||
|
|
||||||
redirect('$head/$tail'.replaceAll(_straySlashes, ''), code: code);
|
redirect('$head/$tail'.replaceAll(_straySlashes, ''), code: code);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import 'hooked_service.dart';
|
||||||
import 'metadata.dart';
|
import 'metadata.dart';
|
||||||
import 'request_context.dart';
|
import 'request_context.dart';
|
||||||
import 'response_context.dart';
|
import 'response_context.dart';
|
||||||
|
import 'server.dart';
|
||||||
import 'service.dart';
|
import 'service.dart';
|
||||||
|
|
||||||
final RegExp _straySlashes = new RegExp(r'(^/+)|(/+$)');
|
final RegExp _straySlashes = new RegExp(r'(^/+)|(/+$)');
|
||||||
|
@ -16,7 +17,7 @@ final RegExp _straySlashes = new RegExp(r'(^/+)|(/+$)');
|
||||||
typedef Future<bool> RequestMiddleware(RequestContext req, ResponseContext res);
|
typedef Future<bool> RequestMiddleware(RequestContext req, ResponseContext res);
|
||||||
|
|
||||||
/// A function that receives an incoming [RequestContext] and responds to it.
|
/// A function that receives an incoming [RequestContext] and responds to it.
|
||||||
typedef Future RequestHandler(RequestContext req, ResponseContext res);
|
typedef FutureOr RequestHandler(RequestContext req, ResponseContext res);
|
||||||
|
|
||||||
/// Sequentially runs a list of [handlers] of middleware, and returns early if any does not
|
/// Sequentially runs a list of [handlers] of middleware, and returns early if any does not
|
||||||
/// return `true`. Works well with [Router].chain.
|
/// return `true`. Works well with [Router].chain.
|
||||||
|
@ -31,8 +32,9 @@ RequestMiddleware waterfall(List handlers) {
|
||||||
runPipeline = () => req.app.executeHandler(handler, req, res);
|
runPipeline = () => req.app.executeHandler(handler, req, res);
|
||||||
else {
|
else {
|
||||||
var current = runPipeline;
|
var current = runPipeline;
|
||||||
runPipeline = () => current().then((result) =>
|
runPipeline = () => current().then((result) => !result
|
||||||
!result ? result : req.app.executeHandler(handler, req, res));
|
? new Future.value(result)
|
||||||
|
: req.app.executeHandler(handler, req, res));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +99,8 @@ class Routable extends Router {
|
||||||
handlerSequence.addAll(middleware ?? []);
|
handlerSequence.addAll(middleware ?? []);
|
||||||
handlerSequence.addAll(handlers);
|
handlerSequence.addAll(handlers);
|
||||||
|
|
||||||
return super.addRoute(method, path, handler, middleware: handlerSequence);
|
return super.addRoute(method, path.toString(), handler,
|
||||||
|
middleware: handlerSequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mounts the given [router] on this instance.
|
/// Mounts the given [router] on this instance.
|
||||||
|
@ -128,8 +131,8 @@ class Routable extends Router {
|
||||||
|
|
||||||
if (_router is AngelBase) {
|
if (_router is AngelBase) {
|
||||||
handlers.add((RequestContext req, ResponseContext res) {
|
handlers.add((RequestContext req, ResponseContext res) {
|
||||||
req.app = _router;
|
req.app = _router as Angel;
|
||||||
res.app = _router;
|
res.app = _router as Angel;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -140,7 +143,7 @@ class Routable extends Router {
|
||||||
Map copiedMiddleware = new Map.from(router.requestMiddleware);
|
Map copiedMiddleware = new Map.from(router.requestMiddleware);
|
||||||
for (String middlewareName in copiedMiddleware.keys) {
|
for (String middlewareName in copiedMiddleware.keys) {
|
||||||
requestMiddleware.putIfAbsent("$middlewarePrefix$middlewareName",
|
requestMiddleware.putIfAbsent("$middlewarePrefix$middlewareName",
|
||||||
() => copiedMiddleware[middlewareName]);
|
() => copiedMiddleware[middlewareName] as RequestHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also copy properties...
|
// Also copy properties...
|
||||||
|
@ -154,7 +157,7 @@ class Routable extends Router {
|
||||||
|
|
||||||
// _router.dumpTree(header: 'Mounting on "$path":');
|
// _router.dumpTree(header: 'Mounting on "$path":');
|
||||||
// root.child(path, debug: debug, handlers: handlers).addChild(router.root);
|
// root.child(path, debug: debug, handlers: handlers).addChild(router.root);
|
||||||
var mounted = mount(path, _router);
|
var mounted = mount(path.toString(), _router);
|
||||||
|
|
||||||
if (_router is Routable) {
|
if (_router is Routable) {
|
||||||
// Copy services, too. :)
|
// Copy services, too. :)
|
||||||
|
|
|
@ -31,7 +31,7 @@ typedef FutureOr AngelConfigurer(Angel app);
|
||||||
/// A powerful real-time/REST/MVC server class.
|
/// A powerful real-time/REST/MVC server class.
|
||||||
class Angel extends AngelBase {
|
class Angel extends AngelBase {
|
||||||
final List<Angel> _children = [];
|
final List<Angel> _children = [];
|
||||||
final Map<String, Tuple3<List, Map, ParseResult<Map<String, String>>>>
|
final Map<String, Tuple3<List, Map, ParseResult<Map<String, dynamic>>>>
|
||||||
handlerCache = new HashMap();
|
handlerCache = new HashMap();
|
||||||
|
|
||||||
Router _flattened;
|
Router _flattened;
|
||||||
|
@ -186,7 +186,7 @@ class Angel extends AngelBase {
|
||||||
'This route will be ignored, and no requests will ever reach it.');
|
'This route will be ignored, and no requests will ever reach it.');
|
||||||
}
|
}
|
||||||
return super
|
return super
|
||||||
.mount(path, router, hooked: hooked != false, namespace: namespace);
|
.mount(path.toString(), router, hooked: hooked != false, namespace: namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads some base dependencies into the service container.
|
/// Loads some base dependencies into the service container.
|
||||||
|
|
|
@ -117,7 +117,7 @@ class Service extends Routable {
|
||||||
if (before != null) handlers.addAll(before.handlers);
|
if (before != null) handlers.addAll(before.handlers);
|
||||||
|
|
||||||
Middleware indexMiddleware = getAnnotation(service.index, Middleware);
|
Middleware indexMiddleware = getAnnotation(service.index, Middleware);
|
||||||
get('/', (req, res) {
|
get('/', (RequestContext req, res) {
|
||||||
return this.index(mergeMap([
|
return this.index(mergeMap([
|
||||||
{'query': req.query},
|
{'query': req.query},
|
||||||
restProvider,
|
restProvider,
|
||||||
|
@ -154,7 +154,7 @@ class Service extends Routable {
|
||||||
|
|
||||||
get(
|
get(
|
||||||
'/:id',
|
'/:id',
|
||||||
(req, res) => this.read(
|
(RequestContext req, res) => this.read(
|
||||||
toId(req.params['id']),
|
toId(req.params['id']),
|
||||||
mergeMap([
|
mergeMap([
|
||||||
{'query': req.query},
|
{'query': req.query},
|
||||||
|
@ -214,7 +214,7 @@ class Service extends Routable {
|
||||||
Middleware removeMiddleware = getAnnotation(service.remove, Middleware);
|
Middleware removeMiddleware = getAnnotation(service.remove, Middleware);
|
||||||
delete(
|
delete(
|
||||||
'/',
|
'/',
|
||||||
(req, res) => this.remove(
|
(RequestContext req, res) => this.remove(
|
||||||
null,
|
null,
|
||||||
mergeMap([
|
mergeMap([
|
||||||
{'query': req.query},
|
{'query': req.query},
|
||||||
|
@ -227,7 +227,7 @@ class Service extends Routable {
|
||||||
(removeMiddleware == null) ? [] : removeMiddleware.handlers));
|
(removeMiddleware == null) ? [] : removeMiddleware.handlers));
|
||||||
delete(
|
delete(
|
||||||
'/:id',
|
'/:id',
|
||||||
(req, res) => this.remove(
|
(RequestContext req, res) => this.remove(
|
||||||
toId(req.params['id']),
|
toId(req.params['id']),
|
||||||
mergeMap([
|
mergeMap([
|
||||||
{'query': req.query},
|
{'query': req.query},
|
||||||
|
|
|
@ -37,15 +37,15 @@ class TypedService<T> extends Service {
|
||||||
Model result = god.deserializeDatum(data, outputType: T);
|
Model result = god.deserializeDatum(data, outputType: T);
|
||||||
|
|
||||||
if (data['createdAt'] is DateTime) {
|
if (data['createdAt'] is DateTime) {
|
||||||
result.createdAt = data['createdAt'];
|
result.createdAt = data['createdAt'] as DateTime;
|
||||||
} else if (data['created_at'] is DateTime) {
|
} else if (data['created_at'] is DateTime) {
|
||||||
result.createdAt = data['created_at'];
|
result.createdAt = data['created_at'] as DateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data['updatedAt'] is DateTime) {
|
if (data['updatedAt'] is DateTime) {
|
||||||
result.updatedAt = data['updatedAt'];
|
result.updatedAt = data['updatedAt'] as DateTime;
|
||||||
} else if (data['updated_at'] is DateTime) {
|
} else if (data['updated_at'] is DateTime) {
|
||||||
result.updatedAt = data['updated_at'];
|
result.updatedAt = data['updated_at'] as DateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// print('x: $x\nresult: $result');
|
// print('x: $x\nresult: $result');
|
||||||
|
|
|
@ -112,7 +112,7 @@ class AngelHttp {
|
||||||
var path = req.path;
|
var path = req.path;
|
||||||
if (path == '/') path = '';
|
if (path == '/') path = '';
|
||||||
|
|
||||||
Tuple3<List, Map, ParseResult<Map<String, String>>> resolveTuple() {
|
Tuple3<List, Map, ParseResult<Map<String, dynamic>>> resolveTuple() {
|
||||||
Router r = app.optimizedRouter;
|
Router r = app.optimizedRouter;
|
||||||
var resolved =
|
var resolved =
|
||||||
r.resolveAbsolute(path, method: req.method, strip: false);
|
r.resolveAbsolute(path, method: req.method, strip: false);
|
||||||
|
@ -147,7 +147,7 @@ class AngelHttp {
|
||||||
else {
|
else {
|
||||||
var current = runPipeline;
|
var current = runPipeline;
|
||||||
runPipeline = () => current().then((result) =>
|
runPipeline = () => current().then((result) =>
|
||||||
!result ? result : app.executeHandler(handler, req, res));
|
!result ? new Future.value(result) : app.executeHandler(handler, req, res));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class AngelHttp {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useZone == false) {
|
if (useZone == false) {
|
||||||
return handle().catchError((e, st) {
|
return handle().catchError((e, StackTrace st) {
|
||||||
if (e is FormatException)
|
if (e is FormatException)
|
||||||
throw new AngelHttpException.badRequest(message: e.message)
|
throw new AngelHttpException.badRequest(message: e.message)
|
||||||
..stackTrace = st;
|
..stackTrace = st;
|
||||||
|
@ -196,7 +196,7 @@ class AngelHttp {
|
||||||
}
|
}
|
||||||
|
|
||||||
return handleAngelHttpException(e, trace, req, res, request);
|
return handleAngelHttpException(e, trace, req, res, request);
|
||||||
}).catchError((e, st) {
|
}).catchError((e, StackTrace st) {
|
||||||
var trace = new Trace.from(st ?? StackTrace.current).terse;
|
var trace = new Trace.from(st ?? StackTrace.current).terse;
|
||||||
request.response.close();
|
request.response.close();
|
||||||
// Ideally, we won't be in a position where an absolutely fatal error occurs,
|
// Ideally, we won't be in a position where an absolutely fatal error occurs,
|
||||||
|
@ -353,7 +353,7 @@ class AngelHttp {
|
||||||
Future<ResponseContext> createResponseContext(HttpResponse response,
|
Future<ResponseContext> createResponseContext(HttpResponse response,
|
||||||
[RequestContext correspondingRequest]) =>
|
[RequestContext correspondingRequest]) =>
|
||||||
new Future<ResponseContext>.value(
|
new Future<ResponseContext>.value(
|
||||||
new HttpResponseContextImpl(response, app, correspondingRequest)
|
new HttpResponseContextImpl(response, app, correspondingRequest as HttpRequestContextImpl)
|
||||||
..serializer = (app.serializer ?? god.serialize)
|
..serializer = (app.serializer ?? god.serialize)
|
||||||
..encoders.addAll(app.encoders ?? {}));
|
..encoders.addAll(app.encoders ?? {}));
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class Controller {
|
||||||
return new Future.value();
|
return new Future.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
Function _routeBuilder(
|
void Function(Symbol, MethodMirror) _routeBuilder(
|
||||||
InstanceMirror instanceMirror, Routable routable, List handlers) {
|
InstanceMirror instanceMirror, Routable routable, List handlers) {
|
||||||
return (Symbol methodName, MethodMirror method) {
|
return (Symbol methodName, MethodMirror method) {
|
||||||
if (method.isRegularMethod &&
|
if (method.isRegularMethod &&
|
||||||
|
@ -74,7 +74,8 @@ class Controller {
|
||||||
|
|
||||||
if (exposeDecl == null) return;
|
if (exposeDecl == null) return;
|
||||||
|
|
||||||
var reflectedMethod = instanceMirror.getField(methodName).reflectee;
|
var reflectedMethod =
|
||||||
|
instanceMirror.getField(methodName).reflectee as Function;
|
||||||
var middleware = []..addAll(handlers)..addAll(exposeDecl.middleware);
|
var middleware = []..addAll(handlers)..addAll(exposeDecl.middleware);
|
||||||
String name = exposeDecl.as?.isNotEmpty == true
|
String name = exposeDecl.as?.isNotEmpty == true
|
||||||
? exposeDecl.as
|
? exposeDecl.as
|
||||||
|
@ -86,7 +87,8 @@ class Controller {
|
||||||
method.parameters[1].type.reflectedType == ResponseContext) {
|
method.parameters[1].type.reflectedType == ResponseContext) {
|
||||||
// Create a regular route
|
// Create a regular route
|
||||||
routeMappings[name] = routable
|
routeMappings[name] = routable
|
||||||
.addRoute(exposeDecl.method, exposeDecl.path, (req, res) {
|
.addRoute(exposeDecl.method, exposeDecl.path,
|
||||||
|
(RequestContext req, ResponseContext res) {
|
||||||
var result = reflectedMethod(req, res);
|
var result = reflectedMethod(req, res);
|
||||||
return result is RequestHandler ? result(req, res) : result;
|
return result is RequestHandler ? result(req, res) : result;
|
||||||
}, middleware: middleware);
|
}, middleware: middleware);
|
||||||
|
@ -112,5 +114,5 @@ class Controller {
|
||||||
Expose findExpose() => reflectClass(runtimeType)
|
Expose findExpose() => reflectClass(runtimeType)
|
||||||
.metadata
|
.metadata
|
||||||
.map((m) => m.reflectee)
|
.map((m) => m.reflectee)
|
||||||
.firstWhere((r) => r is Expose, orElse: () => null);
|
.firstWhere((r) => r is Expose, orElse: () => null) as Expose;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class HttpRequestContextImpl extends RequestContext {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get hostname {
|
String get hostname {
|
||||||
return io.headers.value(HttpHeaders.HOST);
|
return io.headers.value('host');
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The underlying [HttpRequest] instance underneath this context.
|
/// The underlying [HttpRequest] instance underneath this context.
|
||||||
|
|
|
@ -68,7 +68,7 @@ class HttpResponseContextImpl extends ResponseContext {
|
||||||
|
|
||||||
if (encoders.isNotEmpty && correspondingRequest != null) {
|
if (encoders.isNotEmpty && correspondingRequest != null) {
|
||||||
var allowedEncodings = correspondingRequest.headers
|
var allowedEncodings = correspondingRequest.headers
|
||||||
.value(HttpHeaders.ACCEPT_ENCODING)
|
.value('accept-encoding')
|
||||||
?.split(',')
|
?.split(',')
|
||||||
?.map((s) => s.trim())
|
?.map((s) => s.trim())
|
||||||
?.where((s) => s.isNotEmpty)
|
?.where((s) => s.isNotEmpty)
|
||||||
|
@ -92,7 +92,7 @@ class HttpResponseContextImpl extends ResponseContext {
|
||||||
|
|
||||||
if (encoder != null) {
|
if (encoder != null) {
|
||||||
if (firstStream) {
|
if (firstStream) {
|
||||||
io.headers.set(HttpHeaders.CONTENT_ENCODING, key);
|
io.headers.set('content-encoding', key);
|
||||||
}
|
}
|
||||||
|
|
||||||
output = encoders[key].bind(output);
|
output = encoders[key].bind(output);
|
||||||
|
|
|
@ -1,118 +0,0 @@
|
||||||
import 'dart:async';
|
|
||||||
import 'dart:io';
|
|
||||||
import '../core/core.dart';
|
|
||||||
import '../http/http.dart';
|
|
||||||
import 'stats.dart';
|
|
||||||
|
|
||||||
@deprecated
|
|
||||||
class AngelMetrics extends Angel {
|
|
||||||
Angel _inner;
|
|
||||||
StreamSubscription<HttpRequest> _sub;
|
|
||||||
|
|
||||||
AngelMetrics() : super() {
|
|
||||||
get('/metrics', (req, res) {
|
|
||||||
res.contentType = ContentType.HTML;
|
|
||||||
|
|
||||||
var rows = stats.all.map((stat) {
|
|
||||||
return '''
|
|
||||||
<tr>
|
|
||||||
<td>${stat.name}</td>
|
|
||||||
<td>${stat.iterations}</td>
|
|
||||||
<td>${stat.sum}ms</td>
|
|
||||||
<td>${stat.average.toStringAsFixed(2)}ms</td>
|
|
||||||
</tr>''';
|
|
||||||
}).join();
|
|
||||||
|
|
||||||
res.write('''
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<title>Metrics</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Metrics</h1>
|
|
||||||
<i>Updated every 5 seconds</i>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Stat</th>
|
|
||||||
<th># Iterations</th>
|
|
||||||
<th>Total (ms)</th>
|
|
||||||
<th>Average (ms)</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>$rows</tbody>
|
|
||||||
</table>
|
|
||||||
<script>
|
|
||||||
window.setTimeout(function() {
|
|
||||||
window.location.reload();
|
|
||||||
}, 5000);
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
''');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
final AngelMetricsStats stats = new AngelMetricsStats._();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<HttpServer> close() {
|
|
||||||
_sub?.cancel();
|
|
||||||
_inner.close();
|
|
||||||
return super.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<RoutingResult> resolveAll(String absolute, String relative,
|
|
||||||
{String method: 'GET', bool strip: true}) {
|
|
||||||
return stats.resolveAll.run(() =>
|
|
||||||
_inner.resolveAll(absolute, relative, method: method, strip: strip));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> executeHandler(
|
|
||||||
handler, RequestContext req, ResponseContext res) {
|
|
||||||
return stats.executeHandler
|
|
||||||
.run<bool>(() => super.executeHandler(handler, req, res));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future getHandlerResult(handler, RequestContext req, ResponseContext res) {
|
|
||||||
return stats.getHandlerResult
|
|
||||||
.run(() => super.getHandlerResult(handler, req, res));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future runContained(
|
|
||||||
Function handler, RequestContext req, ResponseContext res) {
|
|
||||||
return stats.runContained.run(() => super.runContained(handler, req, res));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class AngelMetricsStats {
|
|
||||||
AngelMetricsStats._() {
|
|
||||||
all = [
|
|
||||||
resolveAll,
|
|
||||||
executeHandler,
|
|
||||||
getHandlerResult,
|
|
||||||
runContained,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
final Stats resolveAll = new Stats('resolveAll');
|
|
||||||
final Stats executeHandler = new Stats('executeHandler');
|
|
||||||
final Stats getHandlerResult = new Stats('getHandlerResult');
|
|
||||||
final Stats runContained = new Stats('runContained');
|
|
||||||
|
|
||||||
List<Stats> all;
|
|
||||||
|
|
||||||
void add(Stats stats) {
|
|
||||||
all.add(stats);
|
|
||||||
}
|
|
||||||
|
|
||||||
void log() {
|
|
||||||
all.forEach((s) => s.log());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
/// Computes averages progressively.
|
|
||||||
|
|
||||||
import 'dart:async';
|
|
||||||
|
|
||||||
class Stats {
|
|
||||||
final String name;
|
|
||||||
|
|
||||||
int _total = 0, _count = 0;
|
|
||||||
double _average = 0.0;
|
|
||||||
|
|
||||||
Stats(this.name);
|
|
||||||
|
|
||||||
double get average => _average ?? (_total / _count);
|
|
||||||
|
|
||||||
int get iterations => _count;
|
|
||||||
|
|
||||||
int get sum => _total;
|
|
||||||
|
|
||||||
void log() {
|
|
||||||
print('$name: $average avg.');
|
|
||||||
}
|
|
||||||
|
|
||||||
void add(int value) {
|
|
||||||
_average = null;
|
|
||||||
_total += value;
|
|
||||||
_count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
FutureOr<T> run<T>(FutureOr<T> f()) {
|
|
||||||
var sw = new Stopwatch();
|
|
||||||
//print('--- $name START');
|
|
||||||
sw.start();
|
|
||||||
|
|
||||||
void whenDone() {
|
|
||||||
sw.stop();
|
|
||||||
var ms = sw.elapsedMilliseconds;
|
|
||||||
add(ms);
|
|
||||||
//print('--- $name DONE after ${ms}ms');
|
|
||||||
}
|
|
||||||
|
|
||||||
var r = f();
|
|
||||||
|
|
||||||
if (r is Future) {
|
|
||||||
return (r as Future).then((x) {
|
|
||||||
whenDone();
|
|
||||||
return x;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
whenDone();
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -20,7 +20,7 @@ getAnnotation(obj, Type T) {
|
||||||
MethodMirror methodMirror = (reflect(obj) as ClosureMirror).function;
|
MethodMirror methodMirror = (reflect(obj) as ClosureMirror).function;
|
||||||
return matchingAnnotation(methodMirror.metadata, T);
|
return matchingAnnotation(methodMirror.metadata, T);
|
||||||
} else {
|
} else {
|
||||||
ClassMirror classMirror = reflectClass(obj.runtimeType);
|
ClassMirror classMirror = reflectClass(obj.runtimeType as Type);
|
||||||
return matchingAnnotation(classMirror.metadata, T);
|
return matchingAnnotation(classMirror.metadata, T);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel_framework
|
name: angel_framework
|
||||||
version: 1.1.4+4
|
version: 1.1.4+5
|
||||||
description: A high-powered HTTP server with DI, routing and more.
|
description: A high-powered HTTP server with DI, routing and more.
|
||||||
author: Tobe O <thosakwe@gmail.com>
|
author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/angel_framework
|
homepage: https://github.com/angel-dart/angel_framework
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel_framework/angel_framework.dart';
|
||||||
import 'package:mock_request/mock_request.dart';
|
import 'package:mock_request/mock_request.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
@ -10,34 +9,36 @@ main() {
|
||||||
test('no content type', () async {
|
test('no content type', () async {
|
||||||
var req = await acceptContentTypes();
|
var req = await acceptContentTypes();
|
||||||
expect(req.acceptsAll, isFalse);
|
expect(req.acceptsAll, isFalse);
|
||||||
expect(req.accepts(ContentType.JSON), isFalse);
|
//expect(req.accepts(ContentType.JSON), isFalse);
|
||||||
expect(req.accepts('application/json'), isFalse);
|
expect(req.accepts('application/json'), isFalse);
|
||||||
expect(req.accepts(ContentType.HTML), isFalse);
|
//expect(req.accepts(ContentType.HTML), isFalse);
|
||||||
expect(req.accepts('text/html'), isFalse);
|
expect(req.accepts('text/html'), isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('wildcard', () async {
|
test('wildcard', () async {
|
||||||
var req = await acceptContentTypes(['*/*']);
|
var req = await acceptContentTypes(['*/*']);
|
||||||
expect(req.acceptsAll, isTrue);
|
expect(req.acceptsAll, isTrue);
|
||||||
expect(req.accepts(ContentType.JSON), isTrue);
|
//expect(req.accepts(ContentType.JSON), isTrue);
|
||||||
expect(req.accepts('application/json'), isTrue);
|
expect(req.accepts('application/json'), isTrue);
|
||||||
expect(req.accepts(ContentType.HTML), isTrue);
|
//expect(req.accepts(ContentType.HTML), isTrue);
|
||||||
expect(req.accepts('text/html'), isTrue);
|
expect(req.accepts('text/html'), isTrue);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('specific type', () async {
|
test('specific type', () async {
|
||||||
var req = await acceptContentTypes(['text/html']);
|
var req = await acceptContentTypes(['text/html']);
|
||||||
expect(req.acceptsAll, isFalse);
|
expect(req.acceptsAll, isFalse);
|
||||||
expect(req.accepts(ContentType.JSON), isFalse);
|
//expect(req.accepts(ContentType.JSON), isFalse);
|
||||||
expect(req.accepts('application/json'), isFalse);
|
expect(req.accepts('application/json'), isFalse);
|
||||||
expect(req.accepts(ContentType.HTML), isTrue);
|
//expect(req.accepts(ContentType.HTML), isTrue);
|
||||||
expect(req.accepts('text/html'), isTrue);
|
expect(req.accepts('text/html'), isTrue);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('strict', () async {
|
test('strict', () async {
|
||||||
var req = await acceptContentTypes(['text/html', "*/*"]);
|
var req = await acceptContentTypes(['text/html', "*/*"]);
|
||||||
expect(req.accepts(ContentType.HTML), isTrue);
|
expect(req.accepts('text/html'), isTrue);
|
||||||
expect(req.accepts(ContentType.JSON, strict: true), isFalse);
|
//expect(req.accepts(ContentType.HTML), isTrue);
|
||||||
|
//expect(req.accepts(ContentType.JSON, strict: true), isFalse);
|
||||||
|
expect(req.accepts('application/json', strict: true), isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
group('disallow null', () {
|
group('disallow null', () {
|
||||||
|
@ -57,7 +58,7 @@ Future<RequestContext> acceptContentTypes(
|
||||||
[Iterable<String> contentTypes = const []]) {
|
[Iterable<String> contentTypes = const []]) {
|
||||||
var headerString = contentTypes.isEmpty ? null : contentTypes.join(',');
|
var headerString = contentTypes.isEmpty ? null : contentTypes.join(',');
|
||||||
var rq = new MockHttpRequest('GET', ENDPOINT);
|
var rq = new MockHttpRequest('GET', ENDPOINT);
|
||||||
rq.headers.set(HttpHeaders.ACCEPT, headerString);
|
rq.headers.set('accept', headerString);
|
||||||
rq.close();
|
rq.close();
|
||||||
var app = new Angel();
|
var app = new Angel();
|
||||||
var http = new AngelHttp(app);
|
var http = new AngelHttp(app);
|
||||||
|
|
|
@ -100,7 +100,7 @@ main() {
|
||||||
test('optional name', () async {
|
test('optional name', () async {
|
||||||
var app = new Angel();
|
var app = new Angel();
|
||||||
await app.configure(new NamedController().configureServer);
|
await app.configure(new NamedController().configureServer);
|
||||||
expect(app.controllers['foo'], new isInstanceOf<NamedController>());
|
expect(app.controllers['foo'], const TypeMatcher<NamedController>());
|
||||||
});
|
});
|
||||||
|
|
||||||
test("middleware", () async {
|
test("middleware", () async {
|
||||||
|
|
|
@ -61,7 +61,7 @@ main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateTodoSingleton(response) {
|
void validateTodoSingleton(response) {
|
||||||
Map todo = json.decode(response.body);
|
Map todo = json.decode(response.body.toString());
|
||||||
expect(todo["id"], equals(null));
|
expect(todo["id"], equals(null));
|
||||||
expect(todo["text"], equals(TEXT));
|
expect(todo["text"], equals(TEXT));
|
||||||
expect(todo["over"], equals(OVER));
|
expect(todo["over"], equals(OVER));
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'dart:io';
|
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel_framework/angel_framework.dart';
|
||||||
import 'package:dart2_constant/convert.dart';
|
import 'package:dart2_constant/convert.dart';
|
||||||
import 'package:matcher/matcher.dart';
|
import 'package:matcher/matcher.dart';
|
||||||
|
@ -7,29 +6,29 @@ import 'package:test/test.dart';
|
||||||
main() {
|
main() {
|
||||||
test('named constructors', () {
|
test('named constructors', () {
|
||||||
expect(new AngelHttpException.badRequest(),
|
expect(new AngelHttpException.badRequest(),
|
||||||
isException(HttpStatus.BAD_REQUEST, '400 Bad Request'));
|
isException(400, '400 Bad Request'));
|
||||||
expect(new AngelHttpException.notAuthenticated(),
|
expect(new AngelHttpException.notAuthenticated(),
|
||||||
isException(HttpStatus.UNAUTHORIZED, '401 Not Authenticated'));
|
isException(401, '401 Not Authenticated'));
|
||||||
expect(new AngelHttpException.paymentRequired(),
|
expect(new AngelHttpException.paymentRequired(),
|
||||||
isException(HttpStatus.PAYMENT_REQUIRED, '402 Payment Required'));
|
isException(402, '402 Payment Required'));
|
||||||
expect(new AngelHttpException.forbidden(),
|
expect(new AngelHttpException.forbidden(),
|
||||||
isException(HttpStatus.FORBIDDEN, '403 Forbidden'));
|
isException(403, '403 Forbidden'));
|
||||||
expect(new AngelHttpException.notFound(),
|
expect(new AngelHttpException.notFound(),
|
||||||
isException(HttpStatus.NOT_FOUND, '404 Not Found'));
|
isException(404, '404 Not Found'));
|
||||||
expect(new AngelHttpException.methodNotAllowed(),
|
expect(new AngelHttpException.methodNotAllowed(),
|
||||||
isException(HttpStatus.METHOD_NOT_ALLOWED, '405 Method Not Allowed'));
|
isException(405, '405 Method Not Allowed'));
|
||||||
expect(new AngelHttpException.notAcceptable(),
|
expect(new AngelHttpException.notAcceptable(),
|
||||||
isException(HttpStatus.NOT_ACCEPTABLE, '406 Not Acceptable'));
|
isException(406, '406 Not Acceptable'));
|
||||||
expect(new AngelHttpException.methodTimeout(),
|
expect(new AngelHttpException.methodTimeout(),
|
||||||
isException(HttpStatus.REQUEST_TIMEOUT, '408 Timeout'));
|
isException(408, '408 Timeout'));
|
||||||
expect(new AngelHttpException.conflict(),
|
expect(new AngelHttpException.conflict(),
|
||||||
isException(HttpStatus.CONFLICT, '409 Conflict'));
|
isException(409, '409 Conflict'));
|
||||||
expect(new AngelHttpException.notProcessable(),
|
expect(new AngelHttpException.notProcessable(),
|
||||||
isException(422, '422 Not Processable'));
|
isException(422, '422 Not Processable'));
|
||||||
expect(new AngelHttpException.notImplemented(),
|
expect(new AngelHttpException.notImplemented(),
|
||||||
isException(HttpStatus.NOT_IMPLEMENTED, '501 Not Implemented'));
|
isException(501, '501 Not Implemented'));
|
||||||
expect(new AngelHttpException.unavailable(),
|
expect(new AngelHttpException.unavailable(),
|
||||||
isException(HttpStatus.SERVICE_UNAVAILABLE, '503 Unavailable'));
|
isException(503, '503 Unavailable'));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('fromMap', () {
|
test('fromMap', () {
|
||||||
|
|
|
@ -22,7 +22,7 @@ main() {
|
||||||
client = new http.Client();
|
client = new http.Client();
|
||||||
app.use('/todos', new TypedService<Todo>(new MapService()));
|
app.use('/todos', new TypedService<Todo>(new MapService()));
|
||||||
app.use('/books', new BookService());
|
app.use('/books', new BookService());
|
||||||
Todos = app.service("todos");
|
Todos = app.service("todos") as HookedService;
|
||||||
|
|
||||||
Todos.beforeAllStream().listen((e) {
|
Todos.beforeAllStream().listen((e) {
|
||||||
print('Fired ${e.eventName}! Data: ${e.data}; Params: ${e.params}');
|
print('Fired ${e.eventName}! Data: ${e.data}; Params: ${e.params}');
|
||||||
|
@ -71,7 +71,7 @@ main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
var response = await client.post("$url/todos",
|
var response = await client.post("$url/todos",
|
||||||
body: god.serialize({"arbitrary": "data"}), headers: headers);
|
body: god.serialize({"arbitrary": "data"}), headers: headers.cast<String, String>());
|
||||||
print(response.body);
|
print(response.body);
|
||||||
Map result = god.deserialize(response.body);
|
Map result = god.deserialize(response.body);
|
||||||
expect(result["hello"], equals("hooked world"));
|
expect(result["hello"], equals("hooked world"));
|
||||||
|
@ -97,7 +97,7 @@ main() {
|
||||||
|
|
||||||
test('metadata', () async {
|
test('metadata', () async {
|
||||||
final service = new HookedService(new IncrementService())..addHooks();
|
final service = new HookedService(new IncrementService())..addHooks();
|
||||||
expect(service.inner, isNot(new isInstanceOf<MapService>()));
|
expect(service.inner, isNot(const TypeMatcher<MapService>()));
|
||||||
IncrementService.TIMES = 0;
|
IncrementService.TIMES = 0;
|
||||||
await service.index();
|
await service.index();
|
||||||
expect(IncrementService.TIMES, equals(2));
|
expect(IncrementService.TIMES, equals(2));
|
||||||
|
@ -128,7 +128,7 @@ main() {
|
||||||
print('Params to $type ${e.eventName}: ${e.params}');
|
print('Params to $type ${e.eventName}: ${e.params}');
|
||||||
expect(e.params, isMap);
|
expect(e.params, isMap);
|
||||||
expect(e.params.keys, contains('provider'));
|
expect(e.params.keys, contains('provider'));
|
||||||
expect(e.params['provider'], const isInstanceOf<Providers>());
|
expect(e.params['provider'], const TypeMatcher<Providers>());
|
||||||
}
|
}
|
||||||
|
|
||||||
svc
|
svc
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:dart2_constant/convert.dart';
|
import 'package:dart2_constant/convert.dart';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel_framework/angel_framework.dart';
|
||||||
import 'package:logging/logging.dart';
|
|
||||||
import 'package:mock_request/mock_request.dart';
|
import 'package:mock_request/mock_request.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ main() {
|
||||||
'/num/parsed/:num',
|
'/num/parsed/:num',
|
||||||
waterfall([
|
waterfall([
|
||||||
(RequestContext req) {
|
(RequestContext req) {
|
||||||
req.params['n'] = num.parse(req.params['num']);
|
req.params['n'] = num.parse(req.params['num'].toString());
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
(num n) => n,
|
(num n) => n,
|
||||||
|
|
|
@ -118,7 +118,7 @@ main() {
|
||||||
var response = await client.get('$url/name/HELLO/last/WORLD');
|
var response = await client.get('$url/name/HELLO/last/WORLD');
|
||||||
print('Response: ${response.body}');
|
print('Response: ${response.body}');
|
||||||
var json_ = json.decode(response.body);
|
var json_ = json.decode(response.body);
|
||||||
expect(json_, new isInstanceOf<Map<String, String>>());
|
expect(json_, const TypeMatcher<Map>());
|
||||||
expect(json_['first'], equals('HELLO'));
|
expect(json_['first'], equals('HELLO'));
|
||||||
expect(json_['last'], equals('WORLD'));
|
expect(json_['last'], equals('WORLD'));
|
||||||
});
|
});
|
||||||
|
@ -157,7 +157,7 @@ main() {
|
||||||
Map headers = {'Content-Type': 'application/json'};
|
Map headers = {'Content-Type': 'application/json'};
|
||||||
String postData = json.encode({'it': 'works'});
|
String postData = json.encode({'it': 'works'});
|
||||||
var response =
|
var response =
|
||||||
await client.post("$url/lambda", headers: headers, body: postData);
|
await client.post("$url/lambda", headers: headers.cast<String, String>(), body: postData);
|
||||||
print('Response: ${response.body}');
|
print('Response: ${response.body}');
|
||||||
expect(json.decode(response.body)['it'], equals('works'));
|
expect(json.decode(response.body)['it'], equals('works'));
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,7 +15,7 @@ main() {
|
||||||
..get(
|
..get(
|
||||||
'/bar',
|
'/bar',
|
||||||
(req, ResponseContext res) =>
|
(req, ResponseContext res) =>
|
||||||
res.serialize({'hello': 'world'}, contentType: ContentType.HTML));
|
res.serialize({'hello': 'world'}, contentType: 'text/html'));
|
||||||
client = new http.Client();
|
client = new http.Client();
|
||||||
|
|
||||||
server = await new AngelHttp(app).startServer();
|
server = await new AngelHttp(app).startServer();
|
||||||
|
@ -33,12 +33,10 @@ main() {
|
||||||
test("correct content-type", () async {
|
test("correct content-type", () async {
|
||||||
var response = await client.get('$url/foo');
|
var response = await client.get('$url/foo');
|
||||||
print('Response: ${response.body}');
|
print('Response: ${response.body}');
|
||||||
expect(response.headers[HttpHeaders.CONTENT_TYPE],
|
expect(response.headers['content-type'], contains('application/json'));
|
||||||
contains(ContentType.JSON.mimeType));
|
|
||||||
|
|
||||||
response = await client.get('$url/bar');
|
response = await client.get('$url/bar');
|
||||||
print('Response: ${response.body}');
|
print('Response: ${response.body}');
|
||||||
expect(response.headers[HttpHeaders.CONTENT_TYPE],
|
expect(response.headers['content-type'], contains('text/html'));
|
||||||
contains(ContentType.HTML.mimeType));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,8 @@ main() {
|
||||||
await app.errorHandler(e, req, res);
|
await app.errorHandler(e, req, res);
|
||||||
await http.sendResponse(rq, req, res);
|
await http.sendResponse(rq, req, res);
|
||||||
expect(
|
expect(
|
||||||
ContentType.parse(rs.headers.value(HttpHeaders.CONTENT_TYPE)).mimeType,
|
ContentType.parse(rs.headers.value('content-type')).mimeType,
|
||||||
ContentType.HTML.mimeType,
|
'text/html',
|
||||||
);
|
);
|
||||||
expect(rs.statusCode, e.statusCode);
|
expect(rs.statusCode, e.statusCode);
|
||||||
var body = await rs.transform(utf8.decoder).join();
|
var body = await rs.transform(utf8.decoder).join();
|
||||||
|
@ -169,35 +169,35 @@ main() {
|
||||||
|
|
||||||
test('can send json', () async {
|
test('can send json', () async {
|
||||||
var rq = new MockHttpRequest('GET', new Uri(path: 'wtf'))
|
var rq = new MockHttpRequest('GET', new Uri(path: 'wtf'))
|
||||||
..headers.set(HttpHeaders.ACCEPT, ContentType.JSON.toString());
|
..headers.set('accept', 'application/json');
|
||||||
rq.close();
|
rq.close();
|
||||||
http.handleRequest(rq);
|
http.handleRequest(rq);
|
||||||
await rq.response.toList();
|
await rq.response.toList();
|
||||||
expect(rq.response.statusCode, HttpStatus.FORBIDDEN);
|
expect(rq.response.statusCode, 403);
|
||||||
expect(
|
expect(
|
||||||
rq.response.headers.contentType.mimeType, ContentType.JSON.mimeType);
|
rq.response.headers.contentType.mimeType, 'application/json');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('can throw in finalizer', () async {
|
test('can throw in finalizer', () async {
|
||||||
var rq = new MockHttpRequest('GET', new Uri(path: 'wtf'))
|
var rq = new MockHttpRequest('GET', new Uri(path: 'wtf'))
|
||||||
..headers.set(HttpHeaders.ACCEPT, ContentType.JSON.toString());
|
..headers.set('accept', 'application/json');
|
||||||
rq.close();
|
rq.close();
|
||||||
http.handleRequest(rq);
|
http.handleRequest(rq);
|
||||||
await rq.response.toList();
|
await rq.response.toList();
|
||||||
expect(rq.response.statusCode, HttpStatus.FORBIDDEN);
|
expect(rq.response.statusCode, 403);
|
||||||
expect(
|
expect(
|
||||||
rq.response.headers.contentType.mimeType, ContentType.JSON.mimeType);
|
rq.response.headers.contentType.mimeType, 'application/json');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('can send html', () async {
|
test('can send html', () async {
|
||||||
var rq = new MockHttpRequest('GET', new Uri(path: 'wtf2'));
|
var rq = new MockHttpRequest('GET', new Uri(path: 'wtf2'));
|
||||||
rq.headers.set(HttpHeaders.ACCEPT, ContentType.HTML.toString());
|
rq.headers.set('accept', 'text/html');
|
||||||
rq.close();
|
rq.close();
|
||||||
http.handleRequest(rq);
|
http.handleRequest(rq);
|
||||||
await rq.response.toList();
|
await rq.response.toList();
|
||||||
expect(rq.response.statusCode, HttpStatus.FORBIDDEN);
|
expect(rq.response.statusCode, 403);
|
||||||
expect(
|
expect(
|
||||||
rq.response.headers.contentType?.mimeType, ContentType.HTML.mimeType);
|
rq.response.headers.contentType?.mimeType, 'text/html');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ main() {
|
||||||
test('can create data', () async {
|
test('can create data', () async {
|
||||||
String postData = god.serialize({'text': 'Hello, world!'});
|
String postData = god.serialize({'text': 'Hello, world!'});
|
||||||
var response =
|
var response =
|
||||||
await client.post("$url/todos", headers: headers, body: postData);
|
await client.post("$url/todos", headers: headers.cast<String, String>(), body: postData);
|
||||||
expect(response.statusCode, 201);
|
expect(response.statusCode, 201);
|
||||||
var json = god.deserialize(response.body);
|
var json = god.deserialize(response.body);
|
||||||
print(json);
|
print(json);
|
||||||
|
@ -61,7 +61,7 @@ main() {
|
||||||
|
|
||||||
test('can fetch data', () async {
|
test('can fetch data', () async {
|
||||||
String postData = god.serialize({'text': 'Hello, world!'});
|
String postData = god.serialize({'text': 'Hello, world!'});
|
||||||
await client.post("$url/todos", headers: headers, body: postData);
|
await client.post("$url/todos", headers: headers.cast<String, String>(), body: postData);
|
||||||
var response = await client.get("$url/todos/0");
|
var response = await client.get("$url/todos/0");
|
||||||
expect(response.statusCode, 200);
|
expect(response.statusCode, 200);
|
||||||
var json = god.deserialize(response.body);
|
var json = god.deserialize(response.body);
|
||||||
|
@ -71,10 +71,10 @@ main() {
|
||||||
|
|
||||||
test('can modify data', () async {
|
test('can modify data', () async {
|
||||||
String postData = god.serialize({'text': 'Hello, world!'});
|
String postData = god.serialize({'text': 'Hello, world!'});
|
||||||
await client.post("$url/todos", headers: headers, body: postData);
|
await client.post("$url/todos", headers: headers.cast<String, String>(), body: postData);
|
||||||
postData = god.serialize({'text': 'modified'});
|
postData = god.serialize({'text': 'modified'});
|
||||||
var response =
|
var response =
|
||||||
await client.patch("$url/todos/0", headers: headers, body: postData);
|
await client.patch("$url/todos/0", headers: headers.cast<String, String>(), body: postData);
|
||||||
expect(response.statusCode, 200);
|
expect(response.statusCode, 200);
|
||||||
var json = god.deserialize(response.body);
|
var json = god.deserialize(response.body);
|
||||||
print(json);
|
print(json);
|
||||||
|
@ -83,10 +83,10 @@ main() {
|
||||||
|
|
||||||
test('can overwrite data', () async {
|
test('can overwrite data', () async {
|
||||||
String postData = god.serialize({'text': 'Hello, world!'});
|
String postData = god.serialize({'text': 'Hello, world!'});
|
||||||
await client.post("$url/todos", headers: headers, body: postData);
|
await client.post("$url/todos", headers: headers.cast<String, String>(), body: postData);
|
||||||
postData = god.serialize({'over': 'write'});
|
postData = god.serialize({'over': 'write'});
|
||||||
var response =
|
var response =
|
||||||
await client.post("$url/todos/0", headers: headers, body: postData);
|
await client.post("$url/todos/0", headers: headers.cast<String, String>(), body: postData);
|
||||||
expect(response.statusCode, 200);
|
expect(response.statusCode, 200);
|
||||||
var json = god.deserialize(response.body);
|
var json = god.deserialize(response.body);
|
||||||
print(json);
|
print(json);
|
||||||
|
@ -97,7 +97,7 @@ main() {
|
||||||
test('can delete data', () async {
|
test('can delete data', () async {
|
||||||
String postData = god.serialize({'text': 'Hello, world!'});
|
String postData = god.serialize({'text': 'Hello, world!'});
|
||||||
var created = await client
|
var created = await client
|
||||||
.post("$url/todos", headers: headers, body: postData)
|
.post("$url/todos", headers: headers.cast<String, String>(), body: postData)
|
||||||
.then((r) => json.decode(r.body));
|
.then((r) => json.decode(r.body));
|
||||||
var response = await client.delete("$url/todos/${created['id']}");
|
var response = await client.delete("$url/todos/${created['id']}");
|
||||||
expect(response.statusCode, 200);
|
expect(response.statusCode, 200);
|
||||||
|
|
|
@ -29,7 +29,7 @@ main() {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
app.get('/hello', (res) {
|
app.get('/hello', (ResponseContext res) {
|
||||||
new Stream<List<int>>.fromIterable(['Hello, world!'.codeUnits]).pipe(res);
|
new Stream<List<int>>.fromIterable(['Hello, world!'.codeUnits]).pipe(res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ main() {
|
||||||
await res.close();
|
await res.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/overwrite', (res) async {
|
app.get('/overwrite', (ResponseContext res) async {
|
||||||
res.statusCode = 32;
|
res.statusCode = 32;
|
||||||
await new Stream<List<int>>.fromIterable(['Hello, world!'.codeUnits])
|
await new Stream<List<int>>.fromIterable(['Hello, world!'.codeUnits])
|
||||||
.pipe(res);
|
.pipe(res);
|
||||||
|
|
|
@ -24,7 +24,7 @@ main() {
|
||||||
new Todo(text: 'a', completed: false, createdAt: now, updatedAt: now);
|
new Todo(text: 'a', completed: false, createdAt: now, updatedAt: now);
|
||||||
var m = svc.serialize(t);
|
var m = svc.serialize(t);
|
||||||
print(m);
|
print(m);
|
||||||
expect(m, {
|
expect(m..remove('_identityHashCode'), {
|
||||||
'id': null,
|
'id': null,
|
||||||
'createdAt': now.toIso8601String(),
|
'createdAt': now.toIso8601String(),
|
||||||
'updatedAt': now.toIso8601String(),
|
'updatedAt': now.toIso8601String(),
|
||||||
|
@ -39,7 +39,7 @@ main() {
|
||||||
'createdAt': now.toIso8601String(),
|
'createdAt': now.toIso8601String(),
|
||||||
'updatedAt': now.toIso8601String()
|
'updatedAt': now.toIso8601String()
|
||||||
});
|
});
|
||||||
expect(m, new isInstanceOf<Todo>());
|
expect(m, const TypeMatcher<Todo>());
|
||||||
var t = m as Todo;
|
var t = m as Todo;
|
||||||
expect(t.createdAt.millisecondsSinceEpoch, now.millisecondsSinceEpoch);
|
expect(t.createdAt.millisecondsSinceEpoch, now.millisecondsSinceEpoch);
|
||||||
});
|
});
|
||||||
|
@ -50,7 +50,7 @@ main() {
|
||||||
'created_at': now.toIso8601String(),
|
'created_at': now.toIso8601String(),
|
||||||
'updated_at': now.toIso8601String()
|
'updated_at': now.toIso8601String()
|
||||||
});
|
});
|
||||||
expect(m, new isInstanceOf<Todo>());
|
expect(m, const TypeMatcher<Todo>());
|
||||||
var t = m as Todo;
|
var t = m as Todo;
|
||||||
expect(t.createdAt.millisecondsSinceEpoch, now.millisecondsSinceEpoch);
|
expect(t.createdAt.millisecondsSinceEpoch, now.millisecondsSinceEpoch);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue