Make RequestContext generic

This commit is contained in:
Tobe O 2018-08-19 23:27:34 -04:00
parent 2a306e1ec3
commit 91c97c78b9
2 changed files with 146 additions and 178 deletions

View file

@ -1,27 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="7b89ff1e-1260-4dcf-9c3d-345de0471ea1" name="Default" comment="Completely removed the `AngelBase` class"> <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$/example/json.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/json.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/injection.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/injection.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/response_context.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/response_context.dart" 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$/lib/src/core/service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/service.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/http/angel_http.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/http/angel_http.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/exception_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/exception_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/general_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/general_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/precontained_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/precontained_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/server_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/server_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/services_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/services_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/streaming_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/streaming_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/" />
@ -47,20 +29,17 @@
<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="214"> <state relative-caret-position="108">
<caret line="551" column="15" selection-start-line="205" selection-start-column="24" selection-end-line="205" selection-end-column="30" /> <caret line="8" column="62" selection-start-line="8" selection-start-column="62" selection-end-line="8" selection-end-column="62" />
<folding>
<element signature="e#38#58#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="angel_http.dart" pinned="false" current-in-tab="true"> <file leaf-file-name="angel_http.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart"> <entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="291"> <state relative-caret-position="419">
<caret line="321" column="37" lean-forward="true" selection-start-line="321" selection-start-column="37" selection-end-line="321" selection-end-column="37" /> <caret line="329" column="33" selection-start-line="328" selection-end-line="329" selection-end-column="33" />
<folding> <folding>
<element signature="e#0#20#0" expanded="true" /> <element signature="e#0#20#0" expanded="true" />
</folding> </folding>
@ -89,40 +68,6 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="core.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/core.dart">
<provider selected="true" editor-type-id="text-editor">
<state>
<folding>
<element signature="e#1#33#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="primitives_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/primitives_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state>
<folding>
<element signature="e#1#31#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="hooked_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/hooked_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1338">
<caret line="23" column="40" selection-start-line="23" selection-start-column="40" selection-end-line="23" selection-end-column="40" />
<folding>
<element signature="e#0#22#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="controller_test.dart" pinned="false" current-in-tab="false"> <file leaf-file-name="controller_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/controller_test.dart"> <entry file="file://$PROJECT_DIR$/test/controller_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
@ -135,8 +80,8 @@
<file leaf-file-name="service.dart" pinned="false" current-in-tab="false"> <file leaf-file-name="service.dart" pinned="false" current-in-tab="false">
<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="576"> <state relative-caret-position="-2042">
<caret line="36" column="11" lean-forward="true" selection-start-line="36" selection-start-column="11" selection-end-line="36" selection-end-column="11" /> <caret line="128" column="5" lean-forward="true" selection-start-line="128" selection-start-column="5" selection-end-line="128" selection-end-column="5" />
<folding> <folding>
<element signature="e#39#59#0" expanded="true" /> <element signature="e#39#59#0" expanded="true" />
</folding> </folding>
@ -144,14 +89,32 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="CHANGELOG.md" pinned="false" current-in-tab="false"> <file leaf-file-name="request_context.dart" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/CHANGELOG.md"> <entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]"> <provider selected="true" editor-type-id="text-editor">
<state split_layout="SPLIT"> <state relative-caret-position="2032">
<first_editor relative-caret-position="192"> <caret line="127" column="7" selection-start-line="127" selection-start-column="7" selection-end-line="127" selection-end-column="7" />
<caret line="12" column="42" selection-start-line="12" selection-start-column="42" selection-end-line="12" selection-end-column="42" /> <folding>
</first_editor> <element signature="e#47#67#0" expanded="true" />
<second_editor /> </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="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>
</file>
<file leaf-file-name="anonymous_service.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/anonymous_service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="80">
<caret line="6" column="36" selection-start-line="6" selection-start-column="36" selection-end-line="6" selection-end-column="36" />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -168,8 +131,6 @@
</component> </component>
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
<findStrings> <findStrings>
<find>_lock()</find>
<find>unmofi</find>
<find>Map&lt;String,</find> <find>Map&lt;String,</find>
<find>as</find> <find>as</find>
<find>redirectTo</find> <find>redirectTo</find>
@ -198,6 +159,8 @@
<find>dart2_constant/io.dart</find> <find>dart2_constant/io.dart</find>
<find>package:dart:convert</find> <find>package:dart:convert</find>
<find>package:dart:io</find> <find>package:dart:io</find>
<find>deprecated</find>
<find>parse</find>
</findStrings> </findStrings>
<replaceStrings> <replaceStrings>
<replace>appa</replace> <replace>appa</replace>
@ -226,10 +189,10 @@
<replace>_foldStringDynamic(result)</replace> <replace>_foldStringDynamic(result)</replace>
<replace>Angel(MirrorsReflector())</replace> <replace>Angel(MirrorsReflector())</replace>
<replace>json.encode</replace> <replace>json.encode</replace>
<replace>json.decode</replace>
<replace>Angel(reflector: M</replace> <replace>Angel(reflector: M</replace>
<replace>dart:convert</replace> <replace>dart:convert</replace>
<replace>dart:io</replace> <replace>dart:io</replace>
<replace>json.decode</replace>
</replaceStrings> </replaceStrings>
<dirStrings> <dirStrings>
<dir>C:\Users\thosa\Source\Angel\framework\lib</dir> <dir>C:\Users\thosa\Source\Angel\framework\lib</dir>
@ -256,11 +219,9 @@
<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$/lib/src/stats/metric_server.dart" /> <option value="$PROJECT_DIR$/lib/src/stats/metric_server.dart" />
<option value="$PROJECT_DIR$/lib/src/util.dart" /> <option value="$PROJECT_DIR$/lib/src/util.dart" />
<option value="$PROJECT_DIR$/lib/src/core/hooked_service.dart" />
<option value="$PROJECT_DIR$/lib/src/http/controller.dart" /> <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$/lib/src/core/request_context.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" />
@ -295,15 +256,17 @@
<option value="$PROJECT_DIR$/example/handle_error.dart" /> <option value="$PROJECT_DIR$/example/handle_error.dart" />
<option value="$PROJECT_DIR$/pubspec.yaml" /> <option value="$PROJECT_DIR$/pubspec.yaml" />
<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/service.dart" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
<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/controller_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/routable.dart" /> <option value="$PROJECT_DIR$/lib/src/core/routable.dart" />
<option value="$PROJECT_DIR$/lib/src/core/server.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$/test/primitives_test.dart" /> <option value="$PROJECT_DIR$/test/primitives_test.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/server.dart" />
<option value="$PROJECT_DIR$/lib/src/core/hooked_service.dart" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
<option value="$PROJECT_DIR$/lib/src/core/service.dart" />
<option value="$PROJECT_DIR$/lib/src/core/request_context.dart" />
</list> </list>
</option> </option>
</component> </component>
@ -722,28 +685,7 @@
<workItem from="1533353660185" duration="262000" /> <workItem from="1533353660185" duration="262000" />
<workItem from="1534009494986" duration="594000" /> <workItem from="1534009494986" duration="594000" />
<workItem from="1534546784803" duration="353000" /> <workItem from="1534546784803" duration="353000" />
<workItem from="1534547885788" duration="5692000" /> <workItem from="1534547885788" duration="6784000" />
</task>
<task id="LOCAL-00079" summary="Update example">
<created>1523044574359</created>
<option name="number" value="00079" />
<option name="presentableId" value="LOCAL-00079" />
<option name="project" value="LOCAL" />
<updated>1523044574359</updated>
</task>
<task id="LOCAL-00080" summary="Use dart2_constant">
<created>1526436313662</created>
<option name="number" value="00080" />
<option name="presentableId" value="LOCAL-00080" />
<option name="project" value="LOCAL" />
<updated>1526436313662</updated>
</task>
<task id="LOCAL-00081" summary="Use dart2_constant">
<created>1526438457813</created>
<option name="number" value="00081" />
<option name="presentableId" value="LOCAL-00081" />
<option name="project" value="LOCAL" />
<updated>1526438457813</updated>
</task> </task>
<task id="LOCAL-00082" summary="Fixed all broken tests"> <task id="LOCAL-00082" summary="Fixed all broken tests">
<created>1526440469836</created> <created>1526440469836</created>
@ -1067,7 +1009,28 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1534733780470</updated> <updated>1534733780470</updated>
</task> </task>
<option name="localTasksCounter" value="128" /> <task id="LOCAL-00128" summary="Remove all usage of dart2_constant">
<created>1534734389546</created>
<option name="number" value="00128" />
<option name="presentableId" value="LOCAL-00128" />
<option name="project" value="LOCAL" />
<updated>1534734389546</updated>
</task>
<task id="LOCAL-00129" summary="Add more to parseId">
<created>1534735099537</created>
<option name="number" value="00129" />
<option name="presentableId" value="LOCAL-00129" />
<option name="project" value="LOCAL" />
<updated>1534735099537</updated>
</task>
<task id="LOCAL-00130" summary="Make parseId static + docs">
<created>1534735212786</created>
<option name="number" value="00130" />
<option name="presentableId" value="LOCAL-00130" />
<option name="project" value="LOCAL" />
<updated>1534735212787</updated>
</task>
<option name="localTasksCounter" value="131" />
<servers /> <servers />
</component> </component>
<component name="TestHistory"> <component name="TestHistory">
@ -1103,7 +1066,7 @@
</history-entry> </history-entry>
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="167991000" /> <option name="totallyTimeSpent" value="169083000" />
</component> </component>
<component name="TodoView"> <component name="TodoView">
<todo-panel id="selected-file"> <todo-panel id="selected-file">
@ -1116,14 +1079,13 @@
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="37" y="23" width="1403" height="784" extended-state="0" /> <frame x="37" y="23" width="1403" height="784" extended-state="0" />
<editor active="true" />
<layout> <layout>
<window_info anchor="right" id="Palette" order="3" /> <window_info anchor="right" id="Palette" order="3" />
<window_info anchor="bottom" id="Tool Output" order="7" /> <window_info anchor="bottom" id="Tool Output" order="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" />
@ -1141,7 +1103,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="Version Control" order="7" weight="0.32905984" /> <window_info anchor="bottom" id="Version Control" order="7" weight="0.32905984" />
<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" visible="true" weight="0.27920645" /> <window_info content_ui="combo" id="Project" order="0" weight="0.27920645" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32905984" /> <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" />
@ -1166,9 +1128,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="Bump" />
<MESSAGE value="Finalizers before sending" />
<MESSAGE value="Added findOne to `Service`" />
<MESSAGE value="Added `Service.findOne` tests" /> <MESSAGE value="Added `Service.findOne` tests" />
<MESSAGE value="Bump version -&gt; 1.1.5" /> <MESSAGE value="Bump version -&gt; 1.1.5" />
<MESSAGE value="Patched another cast bug" /> <MESSAGE value="Patched another cast bug" />
@ -1191,7 +1150,10 @@
<MESSAGE value="Upgrade body_parser dependency" /> <MESSAGE value="Upgrade body_parser dependency" />
<MESSAGE value="Update description" /> <MESSAGE value="Update description" />
<MESSAGE value="Completely removed the `AngelBase` class" /> <MESSAGE value="Completely removed the `AngelBase` class" />
<option name="LAST_COMMIT_MESSAGE" value="Completely removed the `AngelBase` class" /> <MESSAGE value="Remove all usage of dart2_constant" />
<MESSAGE value="Add more to parseId" />
<MESSAGE value="Make parseId static + docs" />
<option name="LAST_COMMIT_MESSAGE" value="Make parseId static + docs" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
@ -1199,21 +1161,6 @@
</breakpoint-manager> </breakpoint-manager>
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file:///usr/local/Cellar/dart/2.0.0-dev.59.0/libexec/lib/io/platform.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="284">
<caret line="145" lean-forward="true" selection-start-line="145" selection-end-line="145" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/http_response_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1360">
<caret line="89" column="49" selection-start-line="89" selection-start-column="49" selection-end-line="89" selection-end-column="49" />
</state>
</provider>
</entry>
<entry file="file:///usr/local/Cellar/dart/2.0.0-dev.65.0/libexec/lib/async/future.dart" />
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/path-1.6.0/lib/src/path_set.dart"> <entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/path-1.6.0/lib/src/path_set.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="470"> <state relative-caret-position="470">
@ -1228,13 +1175,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/anonymous_service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="182">
<caret line="29" column="57" lean-forward="true" selection-start-line="29" selection-start-column="57" selection-end-line="29" selection-end-column="57" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/find_one_test.dart"> <entry file="file://$PROJECT_DIR$/test/find_one_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="288"> <state relative-caret-position="288">
@ -1490,26 +1430,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="576">
<caret line="36" column="11" lean-forward="true" selection-start-line="36" selection-start-column="11" selection-end-line="36" selection-end-column="11" />
<folding>
<element signature="e#39#59#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="192">
<caret line="12" column="42" selection-start-line="12" selection-start-column="42" selection-end-line="12" selection-end-column="42" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/core.dart"> <entry file="file://$PROJECT_DIR$/lib/src/core/core.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state> <state>
@ -1543,30 +1463,56 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/routable.dart"> <entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="928"> <state relative-caret-position="48">
<caret line="58" column="58" lean-forward="true" selection-start-line="58" selection-start-column="58" selection-end-line="58" selection-end-column="58" /> <caret line="3" column="21" selection-start-line="3" selection-start-column="21" selection-end-line="3" selection-end-column="21" />
</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="419">
<caret line="329" column="33" selection-start-line="328" selection-end-line="329" selection-end-column="33" />
<folding> <folding>
<element signature="e#40#60#0" expanded="true" /> <element signature="e#0#20#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<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="214"> <state relative-caret-position="108">
<caret line="551" column="15" selection-start-line="205" selection-start-column="24" selection-end-line="205" selection-end-column="30" /> <caret line="8" column="62" selection-start-line="8" selection-start-column="62" selection-end-line="8" selection-end-column="62" />
<folding>
<element signature="e#38#58#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart"> <entry file="file://$PROJECT_DIR$/lib/src/safe_stream_controller.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="-1402" />
<caret line="3" column="21" selection-start-line="3" selection-start-column="21" selection-end-line="3" selection-end-column="21" /> </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="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">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="80">
<caret line="6" column="36" selection-start-line="6" selection-start-column="36" selection-end-line="6" selection-end-column="36" />
</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="256">
<caret line="16" column="54" selection-start-line="16" selection-start-column="54" selection-end-line="16" selection-end-column="54" />
</first_editor>
<second_editor />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -1579,12 +1525,32 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.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="291"> <state relative-caret-position="928">
<caret line="321" column="37" lean-forward="true" selection-start-line="321" selection-start-column="37" selection-end-line="321" selection-end-column="37" /> <caret line="58" column="58" lean-forward="true" selection-start-line="58" selection-start-column="58" selection-end-line="58" selection-end-column="58" />
<folding> <folding>
<element signature="e#0#20#0" expanded="true" /> <element signature="e#40#60#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="-2042">
<caret line="128" column="5" lean-forward="true" selection-start-line="128" selection-start-column="5" selection-end-line="128" selection-end-column="5" />
<folding>
<element signature="e#39#59#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="2032">
<caret line="127" column="7" selection-start-line="127" selection-start-column="7" selection-end-line="127" selection-end-column="7" />
<folding>
<element signature="e#47#67#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>

View file

@ -1,11 +1,14 @@
library angel_framework.http.request_context; library angel_framework.http.request_context;
import 'dart:async'; import 'dart:async';
import 'dart:io'; import 'dart:io' show Cookie, HttpHeaders, HttpSession, InternetAddress;
import 'dart:mirrors'; import 'dart:mirrors';
import 'package:body_parser/body_parser.dart'; import 'package:body_parser/body_parser.dart';
import 'package:http_parser/http_parser.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
import 'metadata.dart'; import 'metadata.dart';
import 'response_context.dart'; import 'response_context.dart';
import 'routable.dart'; import 'routable.dart';
@ -13,8 +16,8 @@ import 'server.dart' show Angel;
part 'injection.dart'; part 'injection.dart';
/// A convenience wrapper around an incoming HTTP request. /// A convenience wrapper around an incoming [RawRequest].
abstract class RequestContext { abstract class RequestContext<RawRequest> {
String _acceptHeaderCache, _extensionCache; String _acceptHeaderCache, _extensionCache;
bool _acceptsAllCache; bool _acceptsAllCache;
BodyParseResult _body; BodyParseResult _body;
@ -22,6 +25,9 @@ abstract class RequestContext {
final Map properties = {}; final Map properties = {};
/// The underlying [RawRequest] provided by the driver.
RawRequest get rawRequest;
/// Additional params to be passed to services. /// Additional params to be passed to services.
final Map serviceParams = {}; final Map serviceParams = {};
@ -42,10 +48,6 @@ abstract class RequestContext {
/// A [Map] of singletons injected via [inject]. /// A [Map] of singletons injected via [inject].
Map get injections => _injections; Map get injections => _injections;
/// This feature does not map to other adapters (i.e. HTTP/2), so it will be removed in a future version.
@deprecated
HttpRequest get io;
/// The user's IP. /// The user's IP.
String get ip => remoteAddress.address; String get ip => remoteAddress.address;
@ -74,7 +76,7 @@ abstract class RequestContext {
} }
/// The content type of an incoming request. /// The content type of an incoming request.
ContentType get contentType; MediaType get contentType;
/// Any and all files sent to the server with this request. /// Any and all files sent to the server with this request.
/// ///
@ -184,7 +186,7 @@ abstract class RequestContext {
/// * A [ContentType], in which case the `Accept` header will be compared against its `mimeType` property. /// * A [ContentType], in which case the `Accept` header will be compared against its `mimeType` property.
/// * Any other Dart value, in which case the `Accept` header will be compared against the result of a `toString()` call. /// * Any other Dart value, in which case the `Accept` header will be compared against the result of a `toString()` call.
bool accepts(contentType, {bool strict: false}) { bool accepts(contentType, {bool strict: false}) {
var contentTypeString = contentType is ContentType var contentTypeString = contentType is MediaType
? contentType.mimeType ? contentType.mimeType
: contentType?.toString(); : contentType?.toString();