Move all existing handlers to (req, res) or IoC-based

This commit is contained in:
Tobe O 2018-08-20 16:43:38 -04:00
parent 3c37747f07
commit bf9e297a92
19 changed files with 453 additions and 363 deletions

View file

@ -3,8 +3,22 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="7b89ff1e-1260-4dcf-9c3d-345de0471ea1" name="Default" comment=""> <list default="true" id="7b89ff1e-1260-4dcf-9c3d-345de0471ea1" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/routable.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/routable.dart" afterDir="false" /> <change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/main.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/injection.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/injection.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/request_context.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/request_context.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/server.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/server.dart" afterDir="false" /> <change beforePath="$PROJECT_DIR$/lib/src/core/server.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/server.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/service.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/performance/hello/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/performance/hello/main.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/controller_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/controller_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/di_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/di_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/encoders_buffer_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/encoders_buffer_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/parameter_meta_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/parameter_meta_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/primitives_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/primitives_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/repeat_request_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/repeat_request_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/routing_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/routing_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/serialize_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/serialize_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/server_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/server_test.dart" afterDir="false" />
</list> </list>
<ignored path="$PROJECT_DIR$/.tmp/" /> <ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" /> <ignored path="$PROJECT_DIR$/temp/" />
@ -30,8 +44,8 @@
<file leaf-file-name="server.dart" pinned="false" current-in-tab="false"> <file leaf-file-name="server.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/server.dart"> <entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1384"> <state relative-caret-position="222">
<caret line="189" column="31" lean-forward="true" selection-start-line="189" selection-start-column="31" selection-end-line="189" selection-end-column="31" /> <caret line="408" column="27" selection-start-line="408" selection-start-column="27" selection-end-line="408" selection-end-column="27" />
<folding> <folding>
<element signature="e#38#58#0" expanded="true" /> <element signature="e#38#58#0" expanded="true" />
</folding> </folding>
@ -39,50 +53,47 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="routing_test.dart" pinned="false" current-in-tab="true"> <file leaf-file-name="routing_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/routing_test.dart"> <entry file="file://$PROJECT_DIR$/test/routing_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="312"> <state relative-caret-position="-1528">
<caret line="129" column="40" lean-forward="true" selection-start-line="129" selection-start-column="40" selection-end-line="129" selection-end-column="40" /> <caret line="64" column="51" lean-forward="true" selection-start-line="64" selection-start-column="51" selection-end-line="64" selection-end-column="51" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="container.dart" pinned="false" current-in-tab="false"> <file leaf-file-name="main.dart" pinned="false" current-in-tab="false">
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.1/lib/src/container.dart"> <entry file="file://$PROJECT_DIR$/performance/hello/main.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="406"> <state relative-caret-position="294">
<caret line="96" column="33" lean-forward="true" selection-start-line="96" selection-start-column="33" selection-end-line="96" selection-end-column="33" /> <caret line="28" column="21" selection-start-line="28" selection-start-column="21" selection-end-line="28" selection-end-column="21" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="routable.dart" pinned="false" current-in-tab="false"> <file leaf-file-name="injection.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/routable.dart"> <entry file="file://$PROJECT_DIR$/lib/src/core/injection.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="108"> <state>
<caret line="52" column="26" selection-start-line="52" selection-start-column="26" selection-end-line="52" selection-end-column="26" /> <caret column="42" selection-start-column="42" selection-end-column="42" />
<folding>
<element signature="e#40#60#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="primitives_test.dart" pinned="false" current-in-tab="false"> <file leaf-file-name="parameter_meta_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/primitives_test.dart"> <entry file="file://$PROJECT_DIR$/test/parameter_meta_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="178"> <state relative-caret-position="-667">
<caret line="19" column="19" lean-forward="true" selection-start-line="19" selection-start-column="19" selection-end-line="19" selection-end-column="19" /> <caret line="48" column="8" selection-start-line="48" selection-start-column="8" selection-end-line="48" selection-end-column="8" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="service.dart" pinned="false" current-in-tab="false"> <file leaf-file-name="service.dart" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/src/core/service.dart"> <entry file="file://$PROJECT_DIR$/lib/src/core/service.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3216"> <state relative-caret-position="187">
<caret line="201" column="44" selection-start-line="201" selection-start-column="44" selection-end-line="201" selection-end-column="44" /> <caret line="290" column="23" selection-start-line="290" selection-start-column="23" selection-end-line="290" selection-end-column="23" />
<folding> <folding>
<element signature="e#39#59#0" expanded="true" /> <element signature="e#39#59#0" expanded="true" />
</folding> </folding>
@ -90,6 +101,48 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="server_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/server_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165">
<caret line="75" column="45" selection-start-line="75" selection-start-column="45" selection-end-line="75" selection-end-column="45" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="request_context.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="163">
<caret line="67" column="49" selection-start-line="67" selection-start-column="49" selection-end-line="67" selection-end-column="49" />
<folding>
<element signature="e#47#67#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="view.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/view.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="128">
<caret line="8" lean-forward="true" selection-start-line="8" selection-end-line="8" />
<folding>
<element signature="e#0#46#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="hooked_service.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/hooked_service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-3259">
<caret line="6" column="21" selection-start-line="6" selection-start-column="21" selection-end-line="6" selection-end-column="21" />
</state>
</provider>
</entry>
</file>
</leaf> </leaf>
</component> </component>
<component name="FileTemplateManagerImpl"> <component name="FileTemplateManagerImpl">
@ -102,9 +155,6 @@
</component> </component>
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
<findStrings> <findStrings>
<find>random_strin</find>
<find>Angel()</find>
<find>change</find>
<find>render</find> <find>render</find>
<find>god.serialize</find> <find>god.serialize</find>
<find>dart:mirrors</find> <find>dart:mirrors</find>
@ -132,10 +182,11 @@
<find>lazyQue</find> <find>lazyQue</find>
<find>injections</find> <find>injections</find>
<find>singleton(</find> <find>singleton(</find>
<find>preI</find>
<find>);</find>
<find>RequestContext req</find>
</findStrings> </findStrings>
<replaceStrings> <replaceStrings>
<replace>useStream</replace>
<replace>streaming</replace>
<replace>!isOpen</replace> <replace>!isOpen</replace>
<replace>'server'</replace> <replace>'server'</replace>
<replace>FutureOr</replace> <replace>FutureOr</replace>
@ -164,6 +215,8 @@
<replace>json.decode</replace> <replace>json.decode</replace>
<replace>rawRequest.</replace> <replace>rawRequest.</replace>
<replace>rawResponse.</replace> <replace>rawResponse.</replace>
<replace>));</replace>
<replace>req</replace>
</replaceStrings> </replaceStrings>
<dirStrings> <dirStrings>
<dir>C:\Users\thosa\Source\Angel\framework\lib</dir> <dir>C:\Users\thosa\Source\Angel\framework\lib</dir>
@ -187,29 +240,19 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <list>
<option value="$PROJECT_DIR$/lib/src/http/controller.dart" />
<option value="$PROJECT_DIR$/test/exception_test.dart" /> <option value="$PROJECT_DIR$/test/exception_test.dart" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_http_exception-1.0.0/lib/angel_http_exception.dart" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_http_exception-1.0.0/lib/angel_http_exception.dart" />
<option value="$PROJECT_DIR$/test/common.dart" /> <option value="$PROJECT_DIR$/test/common.dart" />
<option value="$PROJECT_DIR$/example/hm.dart" /> <option value="$PROJECT_DIR$/example/hm.dart" />
<option value="$PROJECT_DIR$/test/hm.dart" /> <option value="$PROJECT_DIR$/test/hm.dart" />
<option value="$PROJECT_DIR$/lib/src/core/injection.dart" />
<option value="$PROJECT_DIR$/lib/src/core/anonymous_service.dart" /> <option value="$PROJECT_DIR$/lib/src/core/anonymous_service.dart" />
<option value="$PROJECT_DIR$/test/find_one_test.dart" /> <option value="$PROJECT_DIR$/test/find_one_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/map_service.dart" /> <option value="$PROJECT_DIR$/lib/src/core/map_service.dart" />
<option value="$PROJECT_DIR$/example/view.dart" />
<option value="$PROJECT_DIR$/test/precontained_test.dart" /> <option value="$PROJECT_DIR$/test/precontained_test.dart" />
<option value="$PROJECT_DIR$/test/repeat_request_test.dart" />
<option value="$PROJECT_DIR$/test/server_test.dart" />
<option value="$PROJECT_DIR$/test/streaming_test.dart" />
<option value="$PROJECT_DIR$/test/view_generator_test.dart" /> <option value="$PROJECT_DIR$/test/view_generator_test.dart" />
<option value="$PROJECT_DIR$/test/extension_test.dart" /> <option value="$PROJECT_DIR$/test/extension_test.dart" />
<option value="$PROJECT_DIR$/test/di_test.dart" />
<option value="$PROJECT_DIR$/test/accepts_test.dart" /> <option value="$PROJECT_DIR$/test/accepts_test.dart" />
<option value="$PROJECT_DIR$/test/encoders_buffer_test.dart" />
<option value="$PROJECT_DIR$/test/general_test.dart" />
<option value="$PROJECT_DIR$/example/templating.dart" /> <option value="$PROJECT_DIR$/example/templating.dart" />
<option value="$PROJECT_DIR$/test/serialize_test.dart" />
<option value="$PROJECT_DIR$/lib/hooks.dart" /> <option value="$PROJECT_DIR$/lib/hooks.dart" />
<option value="$PROJECT_DIR$/lib/src/core/typed_service.dart" /> <option value="$PROJECT_DIR$/lib/src/core/typed_service.dart" />
<option value="$PROJECT_DIR$/test/typed_service_test.dart" /> <option value="$PROJECT_DIR$/test/typed_service_test.dart" />
@ -218,26 +261,36 @@
<option value="$PROJECT_DIR$/test/all.dart" /> <option value="$PROJECT_DIR$/test/all.dart" />
<option value="$PROJECT_DIR$/lib/src/core/angel_base.dart" /> <option value="$PROJECT_DIR$/lib/src/core/angel_base.dart" />
<option value="$PROJECT_DIR$/lib/src/core/core.dart" /> <option value="$PROJECT_DIR$/lib/src/core/core.dart" />
<option value="$PROJECT_DIR$/test/controller_test.dart" />
<option value="$PROJECT_DIR$/test/primitives_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/hooked_service.dart" />
<option value="$PROJECT_DIR$/lib/src/core/response_context.dart" /> <option value="$PROJECT_DIR$/lib/src/core/response_context.dart" />
<option value="$PROJECT_DIR$/lib/src/http/http_response_context.dart" /> <option value="$PROJECT_DIR$/lib/src/http/http_response_context.dart" />
<option value="$PROJECT_DIR$/example/handle_error.dart" /> <option value="$PROJECT_DIR$/example/handle_error.dart" />
<option value="$PROJECT_DIR$/example/json.dart" />
<option value="$PROJECT_DIR$/performance/hello/main.dart" />
<option value="$PROJECT_DIR$/test/parameter_meta_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/service.dart" />
<option value="$PROJECT_DIR$/example/main.dart" />
<option value="$PROJECT_DIR$/test/routing_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/metadata.dart" />
<option value="$PROJECT_DIR$/lib/src/http/angel_http.dart" /> <option value="$PROJECT_DIR$/lib/src/http/angel_http.dart" />
<option value="$PROJECT_DIR$/lib/src/core/request_context.dart" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
<option value="$PROJECT_DIR$/pubspec.yaml" /> <option value="$PROJECT_DIR$/pubspec.yaml" />
<option value="$PROJECT_DIR$/lib/src/http/http_request_context.dart" /> <option value="$PROJECT_DIR$/lib/src/http/http_request_context.dart" />
<option value="$PROJECT_DIR$/lib/src/core/server.dart" />
<option value="$PROJECT_DIR$/lib/src/core/routable.dart" /> <option value="$PROJECT_DIR$/lib/src/core/routable.dart" />
<option value="$PROJECT_DIR$/test/general_test.dart" />
<option value="$PROJECT_DIR$/example/json.dart" />
<option value="$PROJECT_DIR$/lib/src/http/controller.dart" />
<option value="$PROJECT_DIR$/lib/src/core/metadata.dart" />
<option value="$PROJECT_DIR$/example/view.dart" />
<option value="$PROJECT_DIR$/lib/src/core/hooked_service.dart" />
<option value="$PROJECT_DIR$/test/streaming_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/injection.dart" />
<option value="$PROJECT_DIR$/example/main.dart" />
<option value="$PROJECT_DIR$/lib/src/core/request_context.dart" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
<option value="$PROJECT_DIR$/test/serialize_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/server.dart" />
<option value="$PROJECT_DIR$/test/parameter_meta_test.dart" />
<option value="$PROJECT_DIR$/test/primitives_test.dart" />
<option value="$PROJECT_DIR$/test/server_test.dart" />
<option value="$PROJECT_DIR$/test/routing_test.dart" />
<option value="$PROJECT_DIR$/test/di_test.dart" />
<option value="$PROJECT_DIR$/test/encoders_buffer_test.dart" />
<option value="$PROJECT_DIR$/test/repeat_request_test.dart" />
<option value="$PROJECT_DIR$/test/controller_test.dart" />
<option value="$PROJECT_DIR$/performance/hello/main.dart" />
<option value="$PROJECT_DIR$/lib/src/core/service.dart" />
</list> </list>
</option> </option>
</component> </component>
@ -657,21 +710,7 @@
<workItem from="1534009494986" duration="594000" /> <workItem from="1534009494986" duration="594000" />
<workItem from="1534546784803" duration="353000" /> <workItem from="1534546784803" duration="353000" />
<workItem from="1534547885788" duration="9908000" /> <workItem from="1534547885788" duration="9908000" />
<workItem from="1534793956753" duration="1252000" /> <workItem from="1534793956753" duration="3713000" />
</task>
<task id="LOCAL-00097" summary="Skip parameter meta tests on newer VM's where it's blocked on: https://github.com/dart-lang/sdk/issues/33774">
<created>1531148520815</created>
<option name="number" value="00097" />
<option name="presentableId" value="LOCAL-00097" />
<option name="project" value="LOCAL" />
<updated>1531148520815</updated>
</task>
<task id="LOCAL-00098" summary="Skip parameter meta tests on newer VM's where it's blocked on: https://github.com/dart-lang/sdk/issues/33774">
<created>1531148881567</created>
<option name="number" value="00098" />
<option name="presentableId" value="LOCAL-00098" />
<option name="project" value="LOCAL" />
<updated>1531148881568</updated>
</task> </task>
<task id="LOCAL-00099" summary="* Patch `ResponseContext.redirectTo` to `fold` parameters, instead of&#10;`as`-casting them to `Map&lt;String, dynamic&gt;`."> <task id="LOCAL-00099" summary="* Patch `ResponseContext.redirectTo` to `fold` parameters, instead of&#10;`as`-casting them to `Map&lt;String, dynamic&gt;`.">
<created>1531149542907</created> <created>1531149542907</created>
@ -1002,7 +1041,21 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1534794944288</updated> <updated>1534794944288</updated>
</task> </task>
<option name="localTasksCounter" value="146" /> <task id="LOCAL-00146" summary="Remove usage of removed symbols">
<created>1534795218407</created>
<option name="number" value="00146" />
<option name="presentableId" value="LOCAL-00146" />
<option name="project" value="LOCAL" />
<updated>1534795218407</updated>
</task>
<task id="LOCAL-00147" summary="Force all handlers to (req, res) { ... }">
<created>1534796466854</created>
<option name="number" value="00147" />
<option name="presentableId" value="LOCAL-00147" />
<option name="project" value="LOCAL" />
<updated>1534796466854</updated>
</task>
<option name="localTasksCounter" value="148" />
<servers /> <servers />
</component> </component>
<component name="TestHistory"> <component name="TestHistory">
@ -1038,7 +1091,7 @@
</history-entry> </history-entry>
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="173459000" /> <option name="totallyTimeSpent" value="175920000" />
</component> </component>
<component name="TodoView"> <component name="TodoView">
<todo-panel id="selected-file"> <todo-panel id="selected-file">
@ -1058,7 +1111,7 @@
<window_info anchor="bottom" id="Event Log" order="7" sideWeight="0.5035524" side_tool="true" weight="0.34188035" /> <window_info anchor="bottom" id="Event Log" order="7" sideWeight="0.5035524" side_tool="true" weight="0.34188035" />
<window_info anchor="right" id="Maven Projects" order="3" /> <window_info anchor="right" id="Maven Projects" order="3" />
<window_info anchor="bottom" id="Database Changes" order="8" show_stripe_button="false" /> <window_info anchor="bottom" id="Database Changes" order="8" show_stripe_button="false" />
<window_info anchor="bottom" id="Dart Analysis" order="7" weight="0.31004366" /> <window_info active="true" anchor="bottom" id="Dart Analysis" order="7" visible="true" weight="0.31004366" />
<window_info anchor="right" id="Flutter Outline" order="4" /> <window_info anchor="right" id="Flutter Outline" order="4" />
<window_info id="Capture Tool" order="2" /> <window_info id="Capture Tool" order="2" />
<window_info id="Designer" order="2" /> <window_info id="Designer" order="2" />
@ -1077,6 +1130,7 @@
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.4964476" weight="0.3973799" /> <window_info anchor="bottom" id="Run" order="2" sideWeight="0.4964476" weight="0.3973799" />
<window_info anchor="bottom" id="Terminal" order="7" weight="0.44978166" /> <window_info anchor="bottom" id="Terminal" order="7" weight="0.44978166" />
<window_info content_ui="combo" id="Project" order="0" weight="0.27846155" /> <window_info content_ui="combo" id="Project" order="0" weight="0.27846155" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32905984" />
<window_info anchor="right" id="SciView" order="4" /> <window_info anchor="right" id="SciView" order="4" />
<window_info anchor="right" id="Theme Preview" order="3" /> <window_info anchor="right" id="Theme Preview" order="3" />
<window_info id="Favorites" order="3" side_tool="true" /> <window_info id="Favorites" order="3" side_tool="true" />
@ -1087,7 +1141,6 @@
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info id="DB Browser" order="2" weight="0.32998413" /> <window_info id="DB Browser" order="2" weight="0.32998413" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32905984" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="right" id="Data View" order="4" /> <window_info anchor="right" id="Data View" order="4" />
@ -1101,8 +1154,6 @@
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" /> <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<MESSAGE value="Force dep on Dart &gt;=2.0.0-dev" />
<MESSAGE value="CHANGELOG now only reflects on 2.0.0-alpha+" />
<MESSAGE value="Remove Jael example" /> <MESSAGE value="Remove Jael example" />
<MESSAGE value="Depend on package:file" /> <MESSAGE value="Depend on package:file" />
<MESSAGE value="Upgrade combinator dependency" /> <MESSAGE value="Upgrade combinator dependency" />
@ -1126,7 +1177,9 @@
<MESSAGE value="waterfall now only accepts RequestHandler" /> <MESSAGE value="waterfall now only accepts RequestHandler" />
<MESSAGE value="Remove req.inject" /> <MESSAGE value="Remove req.inject" />
<MESSAGE value="Implement HttpReqCtx.container" /> <MESSAGE value="Implement HttpReqCtx.container" />
<option name="LAST_COMMIT_MESSAGE" value="Implement HttpReqCtx.container" /> <MESSAGE value="Remove usage of removed symbols" />
<MESSAGE value="Force all handlers to (req, res) { ... }" />
<option name="LAST_COMMIT_MESSAGE" value="Force all handlers to (req, res) { ... }" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
@ -1134,41 +1187,6 @@
</breakpoint-manager> </breakpoint-manager>
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/test/precontained_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="81">
<caret line="8" column="24" selection-start-line="8" selection-start-column="24" selection-end-line="8" selection-end-column="24" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/repeat_request_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="128">
<caret line="13" column="24" selection-start-line="13" selection-start-column="24" selection-end-line="13" selection-end-column="24" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/view_generator_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="96">
<caret line="6" column="24" selection-start-line="6" selection-start-column="24" selection-end-line="6" selection-end-column="24" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/extension_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="368">
<caret line="27" column="22" selection-start-line="27" selection-start-column="22" selection-end-line="27" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/di_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="192">
<caret line="18" column="20" selection-start-line="18" selection-start-column="20" selection-end-line="18" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/accepts_test.dart"> <entry file="file://$PROJECT_DIR$/test/accepts_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289"> <state relative-caret-position="289">
@ -1176,13 +1194,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/example/view.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144">
<caret line="9" column="31" selection-start-line="9" selection-start-column="31" selection-end-line="9" selection-end-column="31" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib/src/media_type.dart"> <entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib/src/media_type.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="235"> <state relative-caret-position="235">
@ -1190,13 +1201,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/test/general_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="160">
<caret line="15" column="42" selection-start-line="15" selection-start-column="42" selection-end-line="15" selection-end-column="42" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/exception_test.dart"> <entry file="file://$PROJECT_DIR$/test/exception_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176"> <state relative-caret-position="176">
@ -1211,28 +1215,7 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/test/encoders_buffer_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="160">
<caret line="17" column="12" lean-forward="true" selection-start-line="17" selection-start-column="12" selection-end-line="17" selection-end-column="12" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/serialize_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="257">
<caret line="39" lean-forward="true" selection-start-line="39" selection-end-line="39" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/hooks.dart" /> <entry file="file://$PROJECT_DIR$/lib/hooks.dart" />
<entry file="file://$PROJECT_DIR$/test/streaming_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="16">
<caret line="10" lean-forward="true" selection-start-line="10" selection-end-line="10" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/common.dart" /> <entry file="file://$PROJECT_DIR$/lib/common.dart" />
<entry file="file://$PROJECT_DIR$/test/typed_service_test.dart" /> <entry file="file://$PROJECT_DIR$/test/typed_service_test.dart" />
<entry file="file://$PROJECT_DIR$/test/services_test.dart"> <entry file="file://$PROJECT_DIR$/test/services_test.dart">
@ -1283,13 +1266,6 @@
<state relative-caret-position="-1402" /> <state relative-caret-position="-1402" />
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/hooked_service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="390">
<caret line="555" column="35" selection-start-line="555" selection-start-column="35" selection-end-line="555" selection-end-column="35" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/anonymous_service.dart"> <entry file="file://$PROJECT_DIR$/lib/src/core/anonymous_service.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="80"> <state relative-caret-position="80">
@ -1297,13 +1273,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/test/controller_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="608">
<caret line="48" column="18" selection-start-line="48" selection-start-column="18" selection-end-line="48" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/http_response_context.dart"> <entry file="file://$PROJECT_DIR$/lib/src/http/http_response_context.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1368"> <state relative-caret-position="-1368">
@ -1314,13 +1283,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/example/json.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="656">
<caret line="41" column="5" selection-start-line="41" selection-start-column="5" selection-end-line="41" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/handle_error.dart"> <entry file="file://$PROJECT_DIR$/example/handle_error.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="48"> <state relative-caret-position="48">
@ -1335,81 +1297,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/performance/hello/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="294">
<caret line="25" column="53" selection-start-line="25" selection-start-column="53" selection-end-line="25" selection-end-column="53" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/parameter_meta_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="336">
<caret line="30" column="50" selection-start-line="30" selection-start-column="50" selection-end-line="30" selection-end-column="50" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/metadata.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-138">
<caret line="93" column="65" selection-start-line="93" selection-start-column="65" selection-end-line="93" selection-end-column="65" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3216">
<caret line="201" column="44" selection-start-line="201" selection-start-column="44" selection-end-line="201" selection-end-column="44" />
<folding>
<element signature="e#39#59#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/server_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="88" column="56" selection-start-line="88" selection-start-column="56" selection-end-line="88" selection-end-column="56" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/injection.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165">
<caret line="51" column="42" lean-forward="true" selection-start-line="51" selection-start-column="42" selection-end-line="51" selection-end-column="42" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="304">
<caret line="19" column="38" lean-forward="true" selection-start-line="19" selection-start-column="38" selection-end-line="19" selection-end-column="38" />
<folding>
<element signature="e#0#46#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="534">
<caret line="346" column="47" selection-start-line="346" selection-start-column="47" selection-end-line="346" selection-end-column="47" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="163">
<caret line="148" lean-forward="true" selection-start-line="148" selection-end-line="148" />
<folding>
<element signature="e#47#67#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.yaml"> <entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="69"> <state relative-caret-position="69">
@ -1417,16 +1304,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="124">
<caret line="10" column="41" selection-start-line="10" selection-start-column="41" selection-end-line="10" selection-end-column="41" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/http_request_context.dart"> <entry file="file://$PROJECT_DIR$/lib/src/http/http_request_context.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="262"> <state relative-caret-position="262">
@ -1444,37 +1321,222 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1384">
<caret line="189" column="31" lean-forward="true" selection-start-line="189" selection-start-column="31" selection-end-line="189" selection-end-column="31" />
<folding>
<element signature="e#38#58#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/routable.dart"> <entry file="file://$PROJECT_DIR$/lib/src/core/routable.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="108"> <state relative-caret-position="-394">
<caret line="52" column="26" selection-start-line="52" selection-start-column="26" selection-end-line="52" selection-end-column="26" /> <caret line="98" column="26" selection-start-line="98" selection-start-column="26" selection-end-line="98" selection-end-column="26" />
<folding> <folding>
<element signature="e#40#60#0" expanded="true" /> <element signature="e#40#60#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/example/json.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="203">
<caret line="40" column="5" selection-start-line="40" selection-start-column="5" selection-end-line="40" selection-end-column="5" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file:///usr/local/Cellar/dart/2.0.0/libexec/lib/core/list.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="149">
<caret line="53" column="15" selection-start-line="53" selection-start-column="15" selection-end-line="53" selection-end-column="15" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/general_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="160">
<caret line="15" column="69" selection-start-line="15" selection-start-column="69" selection-end-line="15" selection-end-column="69" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/controller.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="405">
<caret line="78" column="85" selection-start-line="78" selection-start-column="85" selection-end-line="78" selection-end-column="85" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/metadata.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="149">
<caret line="27" column="32" selection-start-line="27" selection-start-column="32" selection-end-line="27" selection-end-column="32" />
<folding>
<element signature="e#40#104#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1348">
<caret line="127" column="14" selection-start-line="127" selection-start-column="14" selection-end-line="127" selection-end-column="14" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/view.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="128">
<caret line="8" lean-forward="true" selection-start-line="8" selection-end-line="8" />
<folding>
<element signature="e#0#46#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/hooked_service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-3259">
<caret line="6" column="21" selection-start-line="6" selection-start-column="21" selection-end-line="6" selection-end-column="21" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="163">
<caret line="67" column="49" selection-start-line="67" selection-start-column="49" selection-end-line="67" selection-end-column="49" />
<folding>
<element signature="e#47#67#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="556">
<caret line="44" column="84" selection-start-line="44" selection-start-column="84" selection-end-line="44" selection-end-column="84" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/serialize_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176">
<caret line="17" column="26" selection-start-line="17" selection-start-column="26" selection-end-line="17" selection-end-column="26" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/streaming_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-268">
<caret line="30" column="29" lean-forward="true" selection-start-line="30" selection-start-column="29" selection-end-line="30" selection-end-column="29" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="342">
<caret line="33" column="29" selection-start-line="33" selection-start-column="29" selection-end-line="33" selection-end-column="29" />
<folding>
<element signature="e#0#46#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/primitives_test.dart"> <entry file="file://$PROJECT_DIR$/test/primitives_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="178"> <state relative-caret-position="256">
<caret line="19" column="19" lean-forward="true" selection-start-line="19" selection-start-column="19" selection-end-line="19" selection-end-column="19" /> <caret line="22" column="22" lean-forward="true" selection-start-line="22" selection-start-column="22" selection-end-line="22" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/parameter_meta_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-667">
<caret line="48" column="8" selection-start-line="48" selection-start-column="8" selection-end-line="48" selection-end-column="8" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/di_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="192">
<caret line="20" column="51" lean-forward="true" selection-start-line="20" selection-start-column="51" selection-end-line="20" selection-end-column="51" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/encoders_buffer_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="160">
<caret line="28" column="28" selection-start-line="28" selection-start-column="28" selection-end-line="28" selection-end-column="28" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/injection.dart">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="42" selection-start-column="42" selection-end-column="42" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/precontained_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="336">
<caret line="25" lean-forward="true" selection-start-line="25" selection-end-line="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/repeat_request_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="128">
<caret line="15" column="50" selection-start-line="15" selection-start-column="50" selection-end-line="15" selection-end-column="50" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/server_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165">
<caret line="75" column="45" selection-start-line="75" selection-start-column="45" selection-end-line="75" selection-end-column="45" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/controller_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="224">
<caret line="24" column="40" lean-forward="true" selection-start-line="24" selection-start-column="40" selection-end-line="24" selection-end-column="40" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/test/routing_test.dart"> <entry file="file://$PROJECT_DIR$/test/routing_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="312"> <state relative-caret-position="-1528">
<caret line="129" column="40" lean-forward="true" selection-start-line="129" selection-start-column="40" selection-end-line="129" selection-end-column="40" /> <caret line="64" column="51" lean-forward="true" selection-start-line="64" selection-start-column="51" selection-end-line="64" selection-end-column="51" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/performance/hello/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="294">
<caret line="28" column="21" selection-start-line="28" selection-start-column="21" selection-end-line="28" selection-end-column="21" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="222">
<caret line="408" column="27" selection-start-line="408" selection-start-column="27" selection-end-line="408" selection-end-column="27" />
<folding>
<element signature="e#38#58#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="290" column="23" selection-start-line="290" selection-start-column="23" selection-end-line="290" selection-end-column="23" />
<folding>
<element signature="e#39#59#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>

View file

@ -40,3 +40,6 @@ take routes in the form of `FutureOr myFunc(RequestContext, ResponseContext res)
* `@Middleware` now takes an `Iterable` of `RequestHandler`s. * `@Middleware` now takes an `Iterable` of `RequestHandler`s.
* `@Expose.path` now *must* be a `String`, not just any `Pattern`. * `@Expose.path` now *must* be a `String`, not just any `Pattern`.
* `@Expose.middleware` now takes `Iterable<RequestHandler>`, instead of just `List`. * `@Expose.middleware` now takes `Iterable<RequestHandler>`, instead of just `List`.
* `createDynamicHandler` was renamed to `ioc`, and is now used to run IoC-aware handlers in a
type-safe manner.
* `RequestContext.params` is now a `Map<String, dynamic>`, rather than just a `Map`.

View file

@ -5,16 +5,28 @@ main() async {
var app = new Angel(reflector: MirrorsReflector()); var app = new Angel(reflector: MirrorsReflector());
// Index route. Returns JSON. // Index route. Returns JSON.
app.get('/', () => 'Welcome to Angel!'); app.get('/', (req, res) => res.write('Welcome to Angel!'));
// Accepts a URL like /greet/foo or /greet/bob. // Accepts a URL like /greet/foo or /greet/bob.
app.get('/greet/:name', (String name) => 'Hello, $name!'); app.get(
'/greet/:name',
(req, res) {
var name = req.params['name'];
res.write('Hello, $name!');
},
);
// Pattern matching - only call this handler if the query value of `name` equals 'emoji'. // Pattern matching - only call this handler if the query value of `name` equals 'emoji'.
app.get('/greet', (@Query('name', match: 'emoji') String name) => '😇🔥🔥🔥'); app.get(
'/greet',
ioc((@Query('name', match: 'emoji') String name) => '😇🔥🔥🔥'),
);
// Handle any other query value of `name`. // Handle any other query value of `name`.
app.get('/greet', (@Query('name') String name) => 'Hello, $name!'); app.get(
'/greet',
ioc((@Query('name') String name) => 'Hello, $name!'),
);
// Simple fallback to throw a 404 on unknown paths. // Simple fallback to throw a 404 on unknown paths.
app.use((RequestContext req) async { app.use((RequestContext req) async {

View file

@ -5,7 +5,7 @@ const List<Type> _primitiveTypes = [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(Function handler, RequestHandler ioc(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 ?? []);

View file

@ -65,7 +65,7 @@ abstract class RequestContext<RawRequest> {
MediaType get contentType; MediaType get contentType;
/// The URL parameters extracted from the request URI. /// The URL parameters extracted from the request URI.
Map params = {}; Map<String, dynamic> params = <String, dynamic>{};
/// The requested path. /// The requested path.
String get path; String get path;

View file

@ -162,8 +162,9 @@ class Angel extends Routable {
}; };
@override @override
Route addRoute(String method, String path, Object handler, Route<RequestHandler> addRoute(
{Iterable middleware: const []}) { String method, String path, RequestHandler handler,
{Iterable<RequestHandler> middleware: const <RequestHandler>[]}) {
if (_flattened != null) { if (_flattened != null) {
logger?.warning( logger?.warning(
'WARNING: You added a route ($method $path) to the router, after it had been optimized.'); 'WARNING: You added a route ($method $path) to the router, after it had been optimized.');
@ -175,7 +176,7 @@ class Angel extends Routable {
} }
@override @override
mount(Pattern path, Router router) { mount(String path, Router<RequestHandler> router) {
if (_flattened != null) { if (_flattened != null) {
logger?.warning( logger?.warning(
'WARNING: You added mounted a child router ($path) on the router, after it had been optimized.'); 'WARNING: You added mounted a child router ($path) on the router, after it had been optimized.');
@ -275,11 +276,6 @@ class Angel extends Routable {
return getHandlerResult(handler.toList(), req, res); return getHandlerResult(handler.toList(), req, res);
} }
var middleware = (req.app ?? this).findMiddleware(handler);
if (middleware != null) {
return getHandlerResult(middleware, req, res);
}
return new Future.value(handler); return new Future.value(handler);
} }
@ -298,12 +294,6 @@ class Angel extends Routable {
}); });
} }
/// Attempts to find a middleware by the given name within this application.
findMiddleware(key) {
if (requestMiddleware.containsKey(key)) return requestMiddleware[key];
return parent != null ? parent.findMiddleware(key) : null;
}
/// Attempts to find a property by the given name within this application. /// Attempts to find a property by the given name within this application.
findProperty(key) { findProperty(key) {
if (configuration.containsKey(key)) return configuration[key]; if (configuration.containsKey(key)) return configuration[key];
@ -327,7 +317,6 @@ class Angel extends Routable {
} }
void _walk(Router router) { void _walk(Router router) {
router.requestMiddleware.forEach((k, v) => _add(v));
router.middleware.forEach(_add); router.middleware.forEach(_add);
router.routes.forEach((r) { router.routes.forEach((r) {
r.handlers.forEach(_add); r.handlers.forEach(_add);

View file

@ -160,7 +160,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('/', (RequestContext req, res) { get('/', (req, res) {
return req.parseQuery().then((query) { return req.parseQuery().then((query) {
return this.index(mergeMap([ return this.index(mergeMap([
{'query': query}, {'query': query},
@ -174,7 +174,7 @@ class Service extends Routable {
..addAll((indexMiddleware == null) ? [] : indexMiddleware.handlers)); ..addAll((indexMiddleware == null) ? [] : indexMiddleware.handlers));
Middleware createMiddleware = getAnnotation(service.create, Middleware); Middleware createMiddleware = getAnnotation(service.create, Middleware);
post('/', (RequestContext req, ResponseContext res) { post('/', (req, ResponseContext res) {
return req.parseQuery().then((query) { return req.parseQuery().then((query) {
return req.parseBody().then((body) { return req.parseBody().then((body) {
return this return this
@ -199,7 +199,7 @@ class Service extends Routable {
Middleware readMiddleware = getAnnotation(service.read, Middleware); Middleware readMiddleware = getAnnotation(service.read, Middleware);
get('/:id', (RequestContext req, res) { get('/:id', (req, res) {
return req.parseQuery().then((query) { return req.parseQuery().then((query) {
return this.read( return this.read(
parseId(req.params['id']), parseId(req.params['id']),
@ -217,7 +217,7 @@ class Service extends Routable {
Middleware modifyMiddleware = getAnnotation(service.modify, Middleware); Middleware modifyMiddleware = getAnnotation(service.modify, Middleware);
patch( patch(
'/:id', '/:id',
(RequestContext req, res) => req.parseBody().then((body) { (req, res) => req.parseBody().then((body) {
return req.parseQuery().then((query) { return req.parseQuery().then((query) {
return this.modify( return this.modify(
parseId(req.params['id']), parseId(req.params['id']),
@ -237,7 +237,7 @@ class Service extends Routable {
Middleware updateMiddleware = getAnnotation(service.update, Middleware); Middleware updateMiddleware = getAnnotation(service.update, Middleware);
post( post(
'/:id', '/:id',
(RequestContext req, res) => req.parseBody().then((body) { (req, res) => req.parseBody().then((body) {
return req.parseQuery().then((query) { return req.parseQuery().then((query) {
return this.update( return this.update(
parseId(req.params['id']), parseId(req.params['id']),
@ -255,7 +255,7 @@ class Service extends Routable {
(updateMiddleware == null) ? [] : updateMiddleware.handlers)); (updateMiddleware == null) ? [] : updateMiddleware.handlers));
put( put(
'/:id', '/:id',
(RequestContext req, res) => req.parseBody().then((body) { (req, res) => req.parseBody().then((body) {
return req.parseQuery().then((query) { return req.parseQuery().then((query) {
return this.update( return this.update(
parseId(req.params['id']), parseId(req.params['id']),
@ -273,7 +273,7 @@ class Service extends Routable {
(updateMiddleware == null) ? [] : updateMiddleware.handlers)); (updateMiddleware == null) ? [] : updateMiddleware.handlers));
Middleware removeMiddleware = getAnnotation(service.remove, Middleware); Middleware removeMiddleware = getAnnotation(service.remove, Middleware);
delete('/', (RequestContext req, res) { delete('/', (req, res) {
return req.parseQuery().then((query) { return req.parseQuery().then((query) {
return this.remove( return this.remove(
null, null,
@ -288,7 +288,7 @@ class Service extends Routable {
..addAll(handlers) ..addAll(handlers)
..addAll( ..addAll(
(removeMiddleware == null) ? [] : removeMiddleware.handlers)); (removeMiddleware == null) ? [] : removeMiddleware.handlers));
delete('/:id', (RequestContext req, res) { delete('/:id', (req, res) {
return req.parseQuery().then((query) { return req.parseQuery().then((query) {
return this.remove( return this.remove(
parseId(req.params['id']), parseId(req.params['id']),
@ -305,8 +305,8 @@ class Service extends Routable {
(removeMiddleware == null) ? [] : removeMiddleware.handlers)); (removeMiddleware == null) ? [] : removeMiddleware.handlers));
// REST compliance // REST compliance
put('/', () => throw new AngelHttpException.notFound()); put('/', (req, res) => throw new AngelHttpException.notFound());
patch('/', () => throw new AngelHttpException.notFound()); patch('/', (req, res) => throw new AngelHttpException.notFound());
} }
/// Invoked when this service is wrapped within a [HookedService]. /// Invoked when this service is wrapped within a [HookedService].

View file

@ -2,8 +2,10 @@ library angel_framework.http.controller;
import 'dart:async'; import 'dart:async';
import 'dart:mirrors'; import 'dart:mirrors';
import 'package:angel_route/angel_route.dart'; import 'package:angel_route/angel_route.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import '../core/core.dart'; import '../core/core.dart';
/// Supports grouping routes with shared functionality. /// Supports grouping routes with shared functionality.
@ -19,7 +21,7 @@ class Controller {
final bool injectSingleton; final bool injectSingleton;
/// Middleware to run before all handlers in this class. /// Middleware to run before all handlers in this class.
List middleware = []; List<RequestHandler> middleware = [];
/// A mapping of route paths to routes, produced from the [Expose] annotations on this class. /// A mapping of route paths to routes, produced from the [Expose] annotations on this class.
Map<String, Route> routeMappings = {}; Map<String, Route> routeMappings = {};
@ -30,7 +32,9 @@ class Controller {
Future configureServer(Angel app) { Future configureServer(Angel app) {
_app = app; _app = app;
if (injectSingleton != false) _app.container.singleton(this); if (injectSingleton != false) {
_app.container.registerSingleton(this, as: runtimeType);
}
// Load global expose decl // Load global expose decl
ClassMirror classMirror = reflectClass(this.runtimeType); ClassMirror classMirror = reflectClass(this.runtimeType);
@ -52,7 +56,9 @@ class Controller {
// Pre-reflect methods // Pre-reflect methods
InstanceMirror instanceMirror = reflect(this); InstanceMirror instanceMirror = reflect(this);
final handlers = []..addAll(exposeDecl.middleware)..addAll(middleware); final handlers = <RequestHandler>[]
..addAll(exposeDecl.middleware)
..addAll(middleware);
final routeBuilder = _routeBuilder(instanceMirror, routable, handlers); final routeBuilder = _routeBuilder(instanceMirror, routable, handlers);
classMirror.instanceMembers.forEach(routeBuilder); classMirror.instanceMembers.forEach(routeBuilder);
configureRoutes(routable); configureRoutes(routable);
@ -60,7 +66,9 @@ class Controller {
} }
void Function(Symbol, MethodMirror) _routeBuilder( void Function(Symbol, MethodMirror) _routeBuilder(
InstanceMirror instanceMirror, Routable routable, Iterable<RequestHandler> handlers) { InstanceMirror instanceMirror,
Routable routable,
Iterable<RequestHandler> handlers) {
return (Symbol methodName, MethodMirror method) { return (Symbol methodName, MethodMirror method) {
if (method.isRegularMethod && if (method.isRegularMethod &&
methodName != #toString && methodName != #toString &&
@ -76,7 +84,9 @@ class Controller {
var reflectedMethod = var reflectedMethod =
instanceMirror.getField(methodName).reflectee as Function; instanceMirror.getField(methodName).reflectee as Function;
var middleware = <RequestHandler>[]..addAll(handlers)..addAll(exposeDecl.middleware); var middleware = <RequestHandler>[]
..addAll(handlers)
..addAll(exposeDecl.middleware);
String name = exposeDecl.as?.isNotEmpty == true String name = exposeDecl.as?.isNotEmpty == true
? exposeDecl.as ? exposeDecl.as
: MirrorSystem.getName(methodName); : MirrorSystem.getName(methodName);

View file

@ -26,7 +26,7 @@ void start(int id) {
var app = new Angel(reflector: MirrorsReflector()); var app = new Angel(reflector: MirrorsReflector());
var http = new AngelHttp.custom(app, startShared, useZone: false); var http = new AngelHttp.custom(app, startShared, useZone: false);
app.get('/', (ResponseContext res) => res.write('Hello, world!')); app.get('/', (req, res) => res.write('Hello, world!'));
var oldHandler = app.errorHandler; var oldHandler = app.errorHandler;
app.errorHandler = (e, req, res) { app.errorHandler = (e, req, res) {

View file

@ -1,20 +1,20 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:angel_container/mirrors.dart'; import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart'; import 'package:angel_framework/angel_framework.dart';
import 'dart:convert';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:mock_request/mock_request.dart'; import 'package:mock_request/mock_request.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'common.dart'; import 'common.dart';
@Expose("/todos", middleware: ["foo"]) @Expose("/todos", middleware: [foo])
class TodoController extends Controller { class TodoController extends Controller {
List<Todo> todos = [new Todo(text: "Hello", over: "world")]; List<Todo> todos = [new Todo(text: "Hello", over: "world")];
@Expose("/:id", middleware: ["bar"]) @Expose("/:id", middleware: [bar])
Future<Todo> fetchTodo( Future<Todo> fetchTodo(
String id, RequestContext req, ResponseContext res) async { String id, RequestContext req, ResponseContext res) async {
expect(req, isNotNull); expect(req, isNotNull);
@ -37,6 +37,14 @@ class NamedController extends Controller {
optional() => 2; optional() => 2;
} }
void foo(RequestContext req, ResponseContext res) {
res.write("Hello, ");
}
void bar(RequestContext req, ResponseContext res) {
res.write("world!");
}
main() { main() {
Angel app; Angel app;
TodoController ctrl; TodoController ctrl;
@ -46,17 +54,9 @@ main() {
setUp(() async { setUp(() async {
app = new Angel(reflector: MirrorsReflector()); app = new Angel(reflector: MirrorsReflector());
app.requestMiddleware["foo"] = (req, res) async {
res.write("Hello, ");
return true;
};
app.requestMiddleware["bar"] = (req, res) async {
res.write("world!");
return true;
};
app.get( app.get(
"/redirect", "/redirect",
(req, ResponseContext res) async => (req, res) async =>
res.redirectToAction("TodoController@foo", {"foo": "world"})); res.redirectToAction("TodoController@foo", {"foo": "world"}));
await app.configure((ctrl = new TodoController()).configureServer); await app.configure((ctrl = new TodoController()).configureServer);
@ -91,7 +91,7 @@ main() {
var app = new Angel(reflector: MirrorsReflector()); var app = new Angel(reflector: MirrorsReflector());
app.get( app.get(
'/foo', '/foo',
createDynamicHandler(({String bar}) { ioc(({String bar}) {
return 2; return 2;
}, optional: ['bar'])); }, optional: ['bar']));
var rq = new MockHttpRequest('GET', new Uri(path: 'foo')); var rq = new MockHttpRequest('GET', new Uri(path: 'foo'));

View file

@ -1,9 +1,11 @@
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:angel_container/mirrors.dart'; import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart'; import 'package:angel_framework/angel_framework.dart';
import 'dart:convert';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'common.dart'; import 'common.dart';
final String TEXT = "make your bed"; final String TEXT = "make your bed";
@ -20,11 +22,13 @@ main() {
client = new http.Client(); client = new http.Client();
// Inject some todos // Inject some todos
app.container.singleton(new Todo(text: TEXT, over: OVER)); app.container.registerSingleton(new Todo(text: TEXT, over: OVER));
app.get("/errands", (Todo singleton) => singleton); app.get("/errands", ioc((Todo singleton) => singleton));
app.get("/errands3", app.get(
({Errand singleton, Todo foo, RequestContext req}) => singleton.text); "/errands3",
ioc(({Errand singleton, Todo foo, RequestContext req}) =>
singleton.text));
await app.configure(new SingletonController().configureServer); await app.configure(new SingletonController().configureServer);
await app.configure(new ErrandController().configureServer); await app.configure(new ErrandController().configureServer);

View file

@ -26,7 +26,7 @@ main() {
}, },
); );
app.get('/hello', (res) { app.get('/hello', (req, res) {
res.write('Hello, world!'); res.write('Hello, world!');
}); });
}); });

View file

@ -1,7 +1,8 @@
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:angel_container/mirrors.dart';
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:angel_container/mirrors.dart';
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';
@ -31,33 +32,33 @@ parameterMetaTests() {
app = new Angel(reflector: MirrorsReflector()); app = new Angel(reflector: MirrorsReflector());
http = new AngelHttp(app); http = new AngelHttp(app);
app.get('/cookie', (@CookieValue('token') String jwt) { app.get('/cookie', ioc((@CookieValue('token') String jwt) {
return jwt; return jwt;
}); }));
app.get('/header', (@Header('x-foo') String header) { app.get('/header', ioc((@Header('x-foo') String header) {
return header; return header;
}); }));
app.get('/query', (@Query('q') String query) { app.get('/query', ioc((@Query('q') String query) {
return query; return query;
}); }));
app.get('/session', (@Session('foo') String foo) { app.get('/session', ioc((@Session('foo') String foo) {
return foo; return foo;
}); }));
app.get('/match', (@Query('mode', match: 'pos') String mode) { app.get('/match', ioc((@Query('mode', match: 'pos') String mode) {
return 'YES $mode'; return 'YES $mode';
}); }));
app.get('/match', (@Query('mode', match: 'neg') String mode) { app.get('/match', ioc((@Query('mode', match: 'neg') String mode) {
return 'NO $mode'; return 'NO $mode';
}); }));
app.get('/match', (@Query('mode') String mode) { app.get('/match', ioc((@Query('mode') String mode) {
return 'DEFAULT $mode'; return 'DEFAULT $mode';
}); }));
/*app.logger = new Logger('parameter_meta_test') /*app.logger = new Logger('parameter_meta_test')
..onRecord.listen((rec) { ..onRecord.listen((rec) {

View file

@ -1,6 +1,7 @@
import 'dart:convert';
import 'package:angel_container/mirrors.dart'; import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart'; import 'package:angel_framework/angel_framework.dart';
import 'dart:convert';
import 'package:mock_request/mock_request.dart'; import 'package:mock_request/mock_request.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
@ -8,7 +9,7 @@ main() {
test('preinjects functions', () async { test('preinjects functions', () async {
var app = new Angel(reflector: MirrorsReflector()) var app = new Angel(reflector: MirrorsReflector())
..configuration['foo'] = 'bar' ..configuration['foo'] = 'bar'
..get('/foo', echoAppFoo); ..get('/foo', ioc(echoAppFoo));
app.optimizeForProduction(force: true); app.optimizeForProduction(force: true);
print(app.preContained); print(app.preContained);
expect(app.preContained, contains(echoAppFoo)); expect(app.preContained, contains(echoAppFoo));

View file

@ -1,5 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io' show stderr; import 'dart:io' show stderr;
import 'package:angel_container/mirrors.dart'; import 'package:angel_container/mirrors.dart';
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';
@ -10,22 +11,23 @@ main() {
AngelHttp http; AngelHttp http;
setUp(() { setUp(() {
app = new Angel(reflector: MirrorsReflector())..inject('global', 305); // Pitbull! app = new Angel(reflector: MirrorsReflector())
..inject('global', 305); // Pitbull!
http = new AngelHttp(app); http = new AngelHttp(app);
app.get('/string/:string', (String string) => string); app.get('/string/:string', ioc((String string) => string));
app.get( app.get(
'/num/parsed/:num', '/num/parsed/:num',
waterfall([ waterfall([
(RequestContext req) { (req, res) {
req.params['n'] = num.parse(req.params['num'].toString()); req.params['n'] = num.parse(req.params['num'].toString());
return true; return true;
}, },
(num n) => n, ioc((num n) => n),
])); ]));
app.get('/num/global', (num global) => global); app.get('/num/global', ioc((num global) => global));
app.errorHandler = (e, req, res) { app.errorHandler = (e, req, res) {
stderr..writeln(e.error)..writeln(e.stackTrace); stderr..writeln(e.error)..writeln(e.stackTrace);

View file

@ -1,7 +1,8 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'package:angel_container/mirrors.dart'; import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart'; import 'package:angel_framework/angel_framework.dart';
import 'dart:convert';
import 'package:mock_request/mock_request.dart'; import 'package:mock_request/mock_request.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
@ -11,7 +12,8 @@ main() {
} }
test('can request the same url twice', () async { test('can request the same url twice', () async {
var app = new Angel(reflector: MirrorsReflector())..get('/test/:id', (id) => 'Hello $id'); var app = new Angel(reflector: MirrorsReflector())
..get('/test/:id', ioc((id) => 'Hello $id'));
var rq1 = mk(1), rq2 = mk(2), rq3 = mk(1); var rq1 = mk(1), rq2 = mk(2), rq3 = mk(1);
await Future.wait([rq1, rq2, rq3].map(new AngelHttp(app).handleRequest)); await Future.wait([rq1, rq2, rq3].map(new AngelHttp(app).handleRequest));
var body1 = await rq1.response.transform(utf8.decoder).join(), var body1 = await rq1.response.transform(utf8.decoder).join(),

View file

@ -69,8 +69,9 @@ main() {
app.use('/nes', nested); app.use('/nes', nested);
app.get('/meta', testMiddlewareMetadata); app.get('/meta', testMiddlewareMetadata);
app.get('/intercepted', 'This should not be shown', middleware: ['interceptor']); app.get('/intercepted', (req, res) => 'This should not be shown',
app.get('/hello', 'world'); middleware: [interceptor]);
app.get('/hello', (req, res) => 'world');
app.get('/name/:first/last/:last', (req, res) => req.params); app.get('/name/:first/last/:last', (req, res) => req.params);
app.post('/lambda', (RequestContext req, res) => req.parseBody()); app.post('/lambda', (RequestContext req, res) => req.parseBody());
app.use('/todos/:id', todos); app.use('/todos/:id', todos);
@ -86,8 +87,8 @@ main() {
return "Logged"; return "Logged";
}); });
app.get('/method', () => 'Only GET'); app.get('/method', (req, res) => 'Only GET');
app.post('/method', () => 'Only POST'); app.post('/method', (req, res) => 'Only POST');
app.use('/query', new QueryService()); app.use('/query', new QueryService());
@ -98,7 +99,7 @@ main() {
} }
app.chain([write('a')]).chain([write('b'), write('c')]).get( app.chain([write('a')]).chain([write('b'), write('c')]).get(
'/chained', () => false); '/chained', (req, res) => false);
app.use('MJ'); app.use('MJ');

View file

@ -14,8 +14,8 @@ main() {
setUp(() async { setUp(() async {
app = new Angel(reflector: MirrorsReflector()) app = new Angel(reflector: MirrorsReflector())
..get('/foo', () => {'hello': 'world'}) ..get('/foo', ioc(() => {'hello': 'world'}))
..get('/bar', (req, ResponseContext res) async { ..get('/bar', (req, res) async {
res.contentType = new MediaType('text', 'html'); res.contentType = new MediaType('text', 'html');
await res.serialize({'hello': 'world'}); await res.serialize({'hello': 'world'});
}); });

View file

@ -1,8 +1,9 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:angel_container/mirrors.dart'; import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart'; import 'package:angel_framework/angel_framework.dart';
import 'dart:convert';
import 'package:matcher/matcher.dart'; import 'package:matcher/matcher.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';
@ -12,7 +13,8 @@ final Uri $foo = Uri.parse('http://localhost:3000/foo');
/// Additional tests to improve coverage of server.dart /// Additional tests to improve coverage of server.dart
main() { main() {
group('scoping', () { group('scoping', () {
var parent = new Angel(reflector: MirrorsReflector())..configuration['two'] = 2; var parent = new Angel(reflector: MirrorsReflector())
..configuration['two'] = 2;
var child = new Angel(reflector: MirrorsReflector()); var child = new Angel(reflector: MirrorsReflector());
parent.use('/child', child); parent.use('/child', child);
@ -70,10 +72,11 @@ main() {
}); });
test('warning when adding routes to flattened router', () { test('warning when adding routes to flattened router', () {
var app = new Angel(reflector: MirrorsReflector())..optimizeForProduction(force: true); var app = new Angel(reflector: MirrorsReflector())
..optimizeForProduction(force: true);
app.dumpTree(); app.dumpTree();
app.get('/', () => 2); app.get('/', (req, res) => 2);
app.mount('/foo', new Router()..get('/', 3)); app.mount('/foo', new Router()..get('/', (req, res) => 3));
}); });
test('services close on close call', () async { test('services close on close call', () async {
@ -88,7 +91,7 @@ main() {
test('global injection added to injection map', () async { test('global injection added to injection map', () async {
var app = new Angel(reflector: MirrorsReflector())..inject('a', 'b'); var app = new Angel(reflector: MirrorsReflector())..inject('a', 'b');
var http = new AngelHttp(app); var http = new AngelHttp(app);
app.get('/', (String a) => a); app.get('/', ioc((String a) => a));
var rq = new MockHttpRequest('GET', Uri.parse('/'))..close(); var rq = new MockHttpRequest('GET', Uri.parse('/'))..close();
await http.handleRequest(rq); await http.handleRequest(rq);
var body = await rq.response.transform(utf8.decoder).join(); var body = await rq.response.transform(utf8.decoder).join();
@ -153,8 +156,8 @@ main() {
setUp(() async { setUp(() async {
app = new Angel(reflector: MirrorsReflector()); app = new Angel(reflector: MirrorsReflector());
app.get('/wtf', () => throw new AngelHttpException.forbidden()); app.get('/wtf', (req, res) => throw new AngelHttpException.forbidden());
app.get('/wtf2', () => throw new AngelHttpException.forbidden()); app.get('/wtf2', (req, res) => throw new AngelHttpException.forbidden());
http = new AngelHttp(app); http = new AngelHttp(app);
await http.startServer('127.0.0.1', 0); await http.startServer('127.0.0.1', 0);