ResponseContext.isBuffered
This commit is contained in:
parent
f8bca542c4
commit
4d980b8e49
7 changed files with 170 additions and 248 deletions
7
.idea/runConfigurations/json_dart.xml
Normal file
7
.idea/runConfigurations/json_dart.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="json.dart" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application" singleton="true" nameIsGenerated="true">
|
||||||
|
<option name="filePath" value="$PROJECT_DIR$/example/json.dart" />
|
||||||
|
<option name="workingDirectory" value="$PROJECT_DIR$" />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
|
@ -1,7 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="templating.dart" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application" singleton="true" nameIsGenerated="true">
|
|
||||||
<option name="filePath" value="$PROJECT_DIR$/example/templating.dart" />
|
|
||||||
<option name="workingDirectory" value="$PROJECT_DIR$" />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
|
@ -2,14 +2,13 @@
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<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 afterPath="$PROJECT_DIR$/.idea/runConfigurations/json_dart.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/runConfigurations/templating_dart.xml" beforeDir="false" />
|
||||||
<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$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/example/handle_error.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/handle_error.dart" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/example/json.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/json.dart" 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/response_context.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/response_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/http/angel_http.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/http/angel_http.dart" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/lib/src/http/controller.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/http/controller.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" />
|
|
||||||
</list>
|
</list>
|
||||||
<ignored path="$PROJECT_DIR$/.tmp/" />
|
<ignored path="$PROJECT_DIR$/.tmp/" />
|
||||||
<ignored path="$PROJECT_DIR$/temp/" />
|
<ignored path="$PROJECT_DIR$/temp/" />
|
||||||
|
@ -32,108 +31,30 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="FileEditorManager">
|
<component name="FileEditorManager">
|
||||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
<file leaf-file-name="main.dart" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/example/main.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="54">
|
|
||||||
<caret line="4" column="19" selection-start-line="4" selection-start-column="19" selection-end-line="4" selection-end-column="19" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#0#46#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="angel_http.dart" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="-140">
|
|
||||||
<caret line="163" column="31" lean-forward="true" selection-start-line="163" selection-start-column="31" selection-end-line="163" selection-end-column="31" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="routing_test.dart" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/test/routing_test.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="149">
|
|
||||||
<caret line="103" column="31" selection-start-line="103" selection-start-column="31" selection-end-line="103" selection-end-column="31" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="CHANGELOG.md" pinned="false" current-in-tab="true">
|
<file leaf-file-name="CHANGELOG.md" pinned="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||||
<state split_layout="SPLIT">
|
<state split_layout="SPLIT">
|
||||||
<first_editor relative-caret-position="540">
|
<first_editor relative-caret-position="588">
|
||||||
<caret line="53" column="75" selection-start-line="53" selection-start-column="75" selection-end-line="53" selection-end-column="75" />
|
<caret line="58" column="75" selection-start-line="58" selection-start-column="75" selection-end-line="58" selection-end-column="75" />
|
||||||
</first_editor>
|
</first_editor>
|
||||||
<second_editor />
|
<second_editor />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="server_test.dart" pinned="false" current-in-tab="false">
|
<file leaf-file-name="response_context.dart" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/test/server_test.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="160">
|
<state relative-caret-position="269">
|
||||||
<caret line="18" column="17" selection-start-line="18" selection-start-column="17" selection-end-line="18" selection-end-column="17" />
|
<caret line="118" column="19" selection-start-line="118" selection-start-column="19" selection-end-line="118" selection-end-column="19" />
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="server.dart" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="406">
|
|
||||||
<caret line="370" column="38" selection-start-line="370" selection-start-column="38" selection-end-line="370" selection-end-column="38" />
|
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#38#58#0" expanded="true" />
|
<element signature="e#48#68#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="future_impl.dart" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file:///usr/local/opt/dart/libexec/lib/async/future_impl.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="129">
|
|
||||||
<caret line="128" column="17" selection-start-line="128" selection-start-column="17" selection-end-line="128" selection-end-column="17" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="zone.dart" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file:///usr/local/opt/dart/libexec/lib/async/zone.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="129">
|
|
||||||
<caret line="1378" column="53" selection-start-line="1378" selection-start-column="53" selection-end-line="1378" selection-end-column="53" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="controller.dart" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/http/controller.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="-369">
|
|
||||||
<caret line="45" column="34" lean-forward="true" selection-start-line="45" selection-start-column="34" selection-end-line="45" selection-end-column="34" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="handle_error.dart" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/example/handle_error.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="112">
|
|
||||||
<caret line="11" column="15" selection-start-line="11" selection-start-column="15" selection-end-line="11" selection-end-column="15" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
</leaf>
|
</leaf>
|
||||||
</component>
|
</component>
|
||||||
<component name="FileTemplateManagerImpl">
|
<component name="FileTemplateManagerImpl">
|
||||||
|
@ -254,7 +175,6 @@
|
||||||
<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$/pubspec.yaml" />
|
<option value="$PROJECT_DIR$/pubspec.yaml" />
|
||||||
<option value="$PROJECT_DIR$/test/general_test.dart" />
|
<option value="$PROJECT_DIR$/test/general_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/example/json.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/metadata.dart" />
|
<option value="$PROJECT_DIR$/lib/src/core/metadata.dart" />
|
||||||
<option value="$PROJECT_DIR$/example/view.dart" />
|
<option value="$PROJECT_DIR$/example/view.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/streaming_test.dart" />
|
<option value="$PROJECT_DIR$/test/streaming_test.dart" />
|
||||||
|
@ -266,7 +186,6 @@
|
||||||
<option value="$PROJECT_DIR$/test/controller_test.dart" />
|
<option value="$PROJECT_DIR$/test/controller_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/performance/hello/main.dart" />
|
<option value="$PROJECT_DIR$/performance/hello/main.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/precontained_test.dart" />
|
<option value="$PROJECT_DIR$/test/precontained_test.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/core/service.dart" />
|
<option value="$PROJECT_DIR$/lib/src/core/service.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/injection.dart" />
|
<option value="$PROJECT_DIR$/lib/src/core/injection.dart" />
|
||||||
|
@ -278,9 +197,11 @@
|
||||||
<option value="$PROJECT_DIR$/example/handle_error.dart" />
|
<option value="$PROJECT_DIR$/example/handle_error.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/routing_test.dart" />
|
<option value="$PROJECT_DIR$/test/routing_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/test/server_test.dart" />
|
<option value="$PROJECT_DIR$/test/server_test.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/http/angel_http.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/example/main.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/lib/src/core/server.dart" />
|
<option value="$PROJECT_DIR$/lib/src/core/server.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/example/main.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/http/angel_http.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/example/json.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/core/response_context.dart" />
|
||||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
|
@ -318,11 +239,6 @@
|
||||||
<item name="Root" type="cbb8eebc:String" user="Root" />
|
<item name="Root" type="cbb8eebc:String" user="Root" />
|
||||||
<item name="framework" type="cbb8eebc:String" user="framework" />
|
<item name="framework" type="cbb8eebc:String" user="framework" />
|
||||||
</path>
|
</path>
|
||||||
<path>
|
|
||||||
<item name="Root" type="cbb8eebc:String" user="Root" />
|
|
||||||
<item name="framework" type="cbb8eebc:String" user="framework" />
|
|
||||||
<item name="example" type="cbb8eebc:String" user="example" />
|
|
||||||
</path>
|
|
||||||
<path>
|
<path>
|
||||||
<item name="Root" type="cbb8eebc:String" user="Root" />
|
<item name="Root" type="cbb8eebc:String" user="Root" />
|
||||||
<item name="framework" type="cbb8eebc:String" user="framework" />
|
<item name="framework" type="cbb8eebc:String" user="framework" />
|
||||||
|
@ -341,23 +257,6 @@
|
||||||
<item name="src" type="cbb8eebc:String" user="src" />
|
<item name="src" type="cbb8eebc:String" user="src" />
|
||||||
<item name="core" type="cbb8eebc:String" user="core" />
|
<item name="core" type="cbb8eebc:String" user="core" />
|
||||||
</path>
|
</path>
|
||||||
<path>
|
|
||||||
<item name="Root" type="cbb8eebc:String" user="Root" />
|
|
||||||
<item name="framework" type="cbb8eebc:String" user="framework" />
|
|
||||||
<item name="lib" type="cbb8eebc:String" user="lib" />
|
|
||||||
<item name="src" type="cbb8eebc:String" user="src" />
|
|
||||||
<item name="http" type="cbb8eebc:String" user="http" />
|
|
||||||
</path>
|
|
||||||
<path>
|
|
||||||
<item name="Root" type="cbb8eebc:String" user="Root" />
|
|
||||||
<item name="framework" type="cbb8eebc:String" user="framework" />
|
|
||||||
<item name="test" type="cbb8eebc:String" user="test" />
|
|
||||||
</path>
|
|
||||||
<path>
|
|
||||||
<item name="Root" type="cbb8eebc:String" user="Root" />
|
|
||||||
<item name="framework" type="cbb8eebc:String" user="framework" />
|
|
||||||
<item name="tool" type="cbb8eebc:String" user="tool" />
|
|
||||||
</path>
|
|
||||||
</expand>
|
</expand>
|
||||||
<select />
|
<select />
|
||||||
</subPane>
|
</subPane>
|
||||||
|
@ -406,7 +305,7 @@
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="Dart Command Line App.main.dart">
|
<component name="RunManager" selected="Dart Command Line App.performance::hello::raw">
|
||||||
<configuration name="Can serialize function result as JSON in routing_test.dart" type="DartTestRunConfigurationType" factoryName="Dart Test" nameIsGenerated="true">
|
<configuration name="Can serialize function result as JSON in routing_test.dart" type="DartTestRunConfigurationType" factoryName="Dart Test" nameIsGenerated="true">
|
||||||
<option name="filePath" value="$PROJECT_DIR$/test/routing_test.dart" />
|
<option name="filePath" value="$PROJECT_DIR$/test/routing_test.dart" />
|
||||||
<option name="scope" value="GROUP_OR_TEST_BY_NAME" />
|
<option name="scope" value="GROUP_OR_TEST_BY_NAME" />
|
||||||
|
@ -553,15 +452,18 @@
|
||||||
<envs />
|
<envs />
|
||||||
</configuration>
|
</configuration>
|
||||||
<list>
|
<list>
|
||||||
<item itemvalue="Dart Test.All Tests (PRODUCTION)" />
|
|
||||||
<item itemvalue="Dart Test.Can serialize function result as JSON in routing_test.dart" />
|
|
||||||
<item itemvalue="Dart Test.Match routes, even with query params in routing_test.dart" />
|
|
||||||
<item itemvalue="Dart Test.listen before and after in hooked_test.dart" />
|
|
||||||
<item itemvalue="Dart Command Line App.performance::hello (DEV)" />
|
<item itemvalue="Dart Command Line App.performance::hello (DEV)" />
|
||||||
<item itemvalue="Dart Command Line App.performance::hello (PRODUCTION)" />
|
<item itemvalue="Dart Command Line App.performance::hello (PRODUCTION)" />
|
||||||
<item itemvalue="Dart Command Line App.All Tests (for coverage)" />
|
<item itemvalue="Dart Command Line App.All Tests (for coverage)" />
|
||||||
<item itemvalue="Dart Command Line App.performance::hello::raw" />
|
<item itemvalue="Dart Command Line App.performance::hello::raw" />
|
||||||
<item itemvalue="Dart Command Line App.main.dart" />
|
<item itemvalue="Dart Command Line App.main.dart" />
|
||||||
|
<item itemvalue="Dart Command Line App.view.dart" />
|
||||||
|
<item itemvalue="Dart Command Line App.handle_error.dart" />
|
||||||
|
<item itemvalue="Dart Command Line App.json.dart" />
|
||||||
|
<item itemvalue="Dart Test.All Tests (PRODUCTION)" />
|
||||||
|
<item itemvalue="Dart Test.Can serialize function result as JSON in routing_test.dart" />
|
||||||
|
<item itemvalue="Dart Test.Match routes, even with query params in routing_test.dart" />
|
||||||
|
<item itemvalue="Dart Test.listen before and after in hooked_test.dart" />
|
||||||
<item itemvalue="Dart Test.tests in extension_test.dart" />
|
<item itemvalue="Dart Test.tests in extension_test.dart" />
|
||||||
<item itemvalue="Dart Test.global injection added to injection map in server_test.dart" />
|
<item itemvalue="Dart Test.global injection added to injection map in server_test.dart" />
|
||||||
<item itemvalue="Dart Test.middleware in controller_test.dart" />
|
<item itemvalue="Dart Test.middleware in controller_test.dart" />
|
||||||
|
@ -598,11 +500,13 @@
|
||||||
<item itemvalue="Dart Test.encoding in encoders_buffer_test.dart" />
|
<item itemvalue="Dart Test.encoding in encoders_buffer_test.dart" />
|
||||||
<item itemvalue="Dart Test.handleAngelHttpException in server_test.dart" />
|
<item itemvalue="Dart Test.handleAngelHttpException in server_test.dart" />
|
||||||
<item itemvalue="Dart Test.can fetch data in services_test.dart" />
|
<item itemvalue="Dart Test.can fetch data in services_test.dart" />
|
||||||
<item itemvalue="Dart Command Line App.view.dart" />
|
|
||||||
<item itemvalue="Dart Command Line App.handle_error.dart" />
|
|
||||||
<item itemvalue="Dart Command Line App.templating.dart" />
|
|
||||||
<item itemvalue="Dart Test.tests in find_one_test.dart" />
|
<item itemvalue="Dart Test.tests in find_one_test.dart" />
|
||||||
</list>
|
</list>
|
||||||
|
<recent_temporary>
|
||||||
|
<list>
|
||||||
|
<item itemvalue="Dart Command Line App.json.dart" />
|
||||||
|
</list>
|
||||||
|
</recent_temporary>
|
||||||
</component>
|
</component>
|
||||||
<component name="SvnConfiguration">
|
<component name="SvnConfiguration">
|
||||||
<configuration />
|
<configuration />
|
||||||
|
@ -701,21 +605,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="6517000" />
|
<workItem from="1534793956753" duration="7749000" />
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00103" summary="Finalizers before sending">
|
|
||||||
<created>1531155020859</created>
|
|
||||||
<option name="number" value="00103" />
|
|
||||||
<option name="presentableId" value="LOCAL-00103" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1531155020859</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00104" summary="Added findOne to `Service`">
|
|
||||||
<created>1531408133584</created>
|
|
||||||
<option name="number" value="00104" />
|
|
||||||
<option name="presentableId" value="LOCAL-00104" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1531408133586</updated>
|
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00105" summary="Added `Service.findOne` tests">
|
<task id="LOCAL-00105" summary="Added `Service.findOne` tests">
|
||||||
<created>1531408765286</created>
|
<created>1531408765286</created>
|
||||||
|
@ -1046,7 +936,21 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1534812824990</updated>
|
<updated>1534812824990</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="152" />
|
<task id="LOCAL-00152" summary="Add flags to Angel constructor">
|
||||||
|
<created>1534813505067</created>
|
||||||
|
<option name="number" value="00152" />
|
||||||
|
<option name="presentableId" value="LOCAL-00152" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1534813505067</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00153" summary="Catch sync errors when using zone">
|
||||||
|
<created>1534813932227</created>
|
||||||
|
<option name="number" value="00153" />
|
||||||
|
<option name="presentableId" value="LOCAL-00153" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1534813932227</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="154" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TestHistory">
|
<component name="TestHistory">
|
||||||
|
@ -1082,7 +986,7 @@
|
||||||
</history-entry>
|
</history-entry>
|
||||||
</component>
|
</component>
|
||||||
<component name="TimeTrackingManager">
|
<component name="TimeTrackingManager">
|
||||||
<option name="totallyTimeSpent" value="178724000" />
|
<option name="totallyTimeSpent" value="179956000" />
|
||||||
</component>
|
</component>
|
||||||
<component name="TodoView">
|
<component name="TodoView">
|
||||||
<todo-panel id="selected-file">
|
<todo-panel id="selected-file">
|
||||||
|
@ -1145,8 +1049,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="Update description" />
|
|
||||||
<MESSAGE value="Completely removed the `AngelBase` class" />
|
|
||||||
<MESSAGE value="Remove all usage of dart2_constant" />
|
<MESSAGE value="Remove all usage of dart2_constant" />
|
||||||
<MESSAGE value="Add more to parseId" />
|
<MESSAGE value="Add more to parseId" />
|
||||||
<MESSAGE value="Make parseId static + docs" />
|
<MESSAGE value="Make parseId static + docs" />
|
||||||
|
@ -1170,7 +1072,9 @@
|
||||||
<MESSAGE value="Removed debug property" />
|
<MESSAGE value="Removed debug property" />
|
||||||
<MESSAGE value="Starts up, but is broken" />
|
<MESSAGE value="Starts up, but is broken" />
|
||||||
<MESSAGE value="Routable.use only accepts a Service" />
|
<MESSAGE value="Routable.use only accepts a Service" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Routable.use only accepts a Service" />
|
<MESSAGE value="Add flags to Angel constructor" />
|
||||||
|
<MESSAGE value="Catch sync errors when using zone" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Catch sync errors when using zone" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
|
@ -1178,21 +1082,6 @@
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
</component>
|
</component>
|
||||||
<component name="editorHistoryManager">
|
<component name="editorHistoryManager">
|
||||||
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha/lib/src/mirrors/reflector.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="96">
|
|
||||||
<caret line="9" column="8" selection-start-line="9" selection-start-column="8" selection-end-line="9" selection-end-column="8" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/example/templating.dart" />
|
|
||||||
<entry file="file://$PROJECT_DIR$/test/all.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="352">
|
|
||||||
<caret line="22" column="42" selection-start-line="22" selection-start-column="42" selection-end-line="22" selection-end-column="42" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/typed_service.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/core/typed_service.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -1250,16 +1139,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="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">
|
<entry file="file:///usr/local/Cellar/dart/2.0.0/libexec/lib/core/list.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="149">
|
<state relative-caret-position="149">
|
||||||
|
@ -1284,16 +1163,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="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$/test/serialize_test.dart">
|
<entry file="file://$PROJECT_DIR$/test/serialize_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">
|
||||||
|
@ -1343,13 +1212,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="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$/test/precontained_test.dart">
|
<entry file="file://$PROJECT_DIR$/test/precontained_test.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="64">
|
<state relative-caret-position="64">
|
||||||
|
@ -1364,16 +1226,6 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="165">
|
|
||||||
<caret line="317" column="62" selection-start-line="317" selection-start-column="62" selection-end-line="317" selection-end-column="62" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#48#68#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="128">
|
<state relative-caret-position="128">
|
||||||
|
@ -1470,24 +1322,27 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/http/controller.dart">
|
<entry file="file://$PROJECT_DIR$/example/main.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="-369">
|
<state relative-caret-position="42">
|
||||||
<caret line="45" column="34" lean-forward="true" selection-start-line="45" selection-start-column="34" selection-end-line="45" selection-end-column="34" />
|
<caret line="22" column="10" lean-forward="true" selection-start-line="22" selection-start-column="10" selection-end-line="22" selection-end-column="10" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#0#46#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/example/handle_error.dart">
|
<entry file="file:///usr/local/Cellar/dart/2.0.0/libexec/lib/async/zone.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="112">
|
<state relative-caret-position="859">
|
||||||
<caret line="11" column="15" selection-start-line="11" selection-start-column="15" selection-end-line="11" selection-end-column="15" />
|
<caret line="445" column="7" selection-start-line="445" selection-start-column="7" selection-end-line="445" selection-end-column="7" />
|
||||||
</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="149">
|
<state relative-caret-position="182">
|
||||||
<caret line="103" column="31" selection-start-line="103" selection-start-column="31" selection-end-line="103" selection-end-column="31" />
|
<caret line="195" column="18" lean-forward="true" selection-start-line="195" selection-start-column="18" selection-end-line="195" selection-end-column="18" />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -1498,6 +1353,16 @@
|
||||||
</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="129">
|
||||||
|
<caret line="254" column="26" selection-start-line="254" selection-start-column="26" selection-end-line="254" selection-end-column="26" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#38#58#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
<entry file="file:///usr/local/opt/dart/libexec/lib/async/future_impl.dart">
|
<entry file="file:///usr/local/opt/dart/libexec/lib/async/future_impl.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="129">
|
<state relative-caret-position="129">
|
||||||
|
@ -1512,32 +1377,78 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/example/main.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/http/controller.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="54">
|
<state relative-caret-position="-369">
|
||||||
<caret line="4" column="19" selection-start-line="4" selection-start-column="19" selection-end-line="4" selection-end-column="19" />
|
<caret line="45" column="34" lean-forward="true" selection-start-line="45" selection-start-column="34" selection-end-line="45" selection-end-column="34" />
|
||||||
<folding>
|
|
||||||
<element signature="e#0#46#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<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="-140">
|
<state relative-caret-position="302">
|
||||||
<caret line="163" column="31" lean-forward="true" selection-start-line="163" selection-start-column="31" selection-end-line="163" selection-end-column="31" />
|
<caret line="32" column="2" selection-start-line="32" selection-start-column="2" selection-end-line="32" selection-end-column="2" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#20#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$/example/handle_error.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="144">
|
||||||
<caret line="370" column="38" selection-start-line="370" selection-start-column="38" selection-end-line="370" selection-end-column="38" />
|
<caret line="13" column="21" lean-forward="true" selection-start-line="13" selection-start-column="21" selection-end-line="13" selection-end-column="21" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/example/view.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="48">
|
||||||
|
<caret line="3" column="14" lean-forward="true" selection-start-line="3" selection-start-column="14" selection-end-line="3" selection-end-column="14" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#38#58#0" expanded="true" />
|
<element signature="e#0#46#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/performance/hello/angel.md">
|
||||||
|
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||||
|
<state split_layout="SPLIT">
|
||||||
|
<first_editor relative-caret-position="-663" />
|
||||||
|
<second_editor />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/performance/hello/raw.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="160">
|
||||||
|
<caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/performance/hello/main.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="566">
|
||||||
|
<caret line="42" lean-forward="true" selection-start-line="42" selection-end-line="42" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/example/json.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="294">
|
||||||
|
<caret line="37" lean-forward="true" selection-start-line="37" selection-end-line="37" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="269">
|
||||||
|
<caret line="118" column="19" selection-start-line="118" selection-start-column="19" selection-end-line="118" selection-end-column="19" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#48#68#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -1545,8 +1456,8 @@
|
||||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||||
<state split_layout="SPLIT">
|
<state split_layout="SPLIT">
|
||||||
<first_editor relative-caret-position="540">
|
<first_editor relative-caret-position="588">
|
||||||
<caret line="53" column="75" selection-start-line="53" selection-start-column="75" selection-end-line="53" selection-end-column="75" />
|
<caret line="58" column="75" selection-start-line="58" selection-start-column="75" selection-end-line="58" selection-end-column="75" />
|
||||||
</first_editor>
|
</first_editor>
|
||||||
<second_editor />
|
<second_editor />
|
||||||
</state>
|
</state>
|
||||||
|
|
|
@ -52,3 +52,8 @@ not very elegant.
|
||||||
* Removed `Angel.createZoneForRequest`.
|
* Removed `Angel.createZoneForRequest`.
|
||||||
* Removed `Angel.defaultZoneCreator`.
|
* Removed `Angel.defaultZoneCreator`.
|
||||||
* Added all flags to the `Angel` constructor, ex. `Angel.eagerParseBodies`.
|
* Added all flags to the `Angel` constructor, ex. `Angel.eagerParseBodies`.
|
||||||
|
* Fix a bug where synchronous errors in `handleRequest` would not be caught.
|
||||||
|
* `AngelHttp.useZone` now defaults to `false`.
|
||||||
|
* `ResponseContext` now starts in streaming mode by default; the response buffer is opt-in,
|
||||||
|
as in many cases it is unnecessary and slows down response time.
|
||||||
|
* `ResponseContext.streaming` was replaced by `ResponseContext.isBuffered`.
|
|
@ -1,6 +1,8 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
import 'dart:isolate';
|
import 'dart:isolate';
|
||||||
|
|
||||||
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';
|
||||||
|
|
||||||
|
@ -16,7 +18,7 @@ main() async {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 1; i < Platform.numberOfProcessors; i++) {
|
||||||
var isolate = await Isolate.spawn(serverMain, null);
|
var isolate = await Isolate.spawn(serverMain, null);
|
||||||
isolates.add(isolate);
|
isolates.add(isolate);
|
||||||
print('Spawned isolate #${i + 1}...');
|
print('Spawned isolate #${i + 1}...');
|
||||||
|
@ -24,6 +26,8 @@ main() async {
|
||||||
isolate.addOnExitListener(exit.sendPort);
|
isolate.addOnExitListener(exit.sendPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serverMain(null);
|
||||||
|
|
||||||
print('Angel listening at http://localhost:3000');
|
print('Angel listening at http://localhost:3000');
|
||||||
await c.future;
|
await c.future;
|
||||||
}
|
}
|
||||||
|
@ -40,9 +44,6 @@ serverMain(_) async {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Performance tuning
|
|
||||||
app..serializer = json.encode;
|
|
||||||
|
|
||||||
app.errorHandler = (e, req, res) {
|
app.errorHandler = (e, req, res) {
|
||||||
print(e.message ?? e.error ?? e);
|
print(e.message ?? e.error ?? e);
|
||||||
print(e.stackTrace);
|
print(e.stackTrace);
|
||||||
|
|
|
@ -20,7 +20,7 @@ final RegExp _straySlashes = new RegExp(r'(^/+)|(/+$)');
|
||||||
abstract class ResponseContext<RawResponse>
|
abstract class ResponseContext<RawResponse>
|
||||||
implements StreamSink<List<int>>, StringSink {
|
implements StreamSink<List<int>>, StringSink {
|
||||||
final Map properties = {};
|
final Map properties = {};
|
||||||
final BytesBuilder _buffer = new _LockableBytesBuilder();
|
BytesBuilder _buffer;
|
||||||
final Map<String, String> _headers = {'server': 'angel'};
|
final Map<String, String> _headers = {'server': 'angel'};
|
||||||
|
|
||||||
Completer _done;
|
Completer _done;
|
||||||
|
@ -54,7 +54,7 @@ abstract class ResponseContext<RawResponse>
|
||||||
/// Headers that will be sent to the user.
|
/// Headers that will be sent to the user.
|
||||||
Map<String, String> get headers {
|
Map<String, String> get headers {
|
||||||
/// If the response is closed, then this getter will return an immutable `Map`.
|
/// If the response is closed, then this getter will return an immutable `Map`.
|
||||||
if (streaming)
|
if (!isBuffered)
|
||||||
return new Map<String, String>.unmodifiable(_headers);
|
return new Map<String, String>.unmodifiable(_headers);
|
||||||
else
|
else
|
||||||
return _headers;
|
return _headers;
|
||||||
|
@ -87,8 +87,8 @@ abstract class ResponseContext<RawResponse>
|
||||||
/// Can we still write to this response?
|
/// Can we still write to this response?
|
||||||
bool get isOpen;
|
bool get isOpen;
|
||||||
|
|
||||||
/// Returns `true` if a [Stream] is being written directly.
|
/// Returns `true` if response data is being written to a buffer, rather than to the underlying stream.
|
||||||
bool get streaming;
|
bool get isBuffered;
|
||||||
|
|
||||||
/// A set of UTF-8 encoded bytes that will be written to the response.
|
/// A set of UTF-8 encoded bytes that will be written to the response.
|
||||||
BytesBuilder get buffer => _buffer;
|
BytesBuilder get buffer => _buffer;
|
||||||
|
@ -116,7 +116,7 @@ abstract class ResponseContext<RawResponse>
|
||||||
headers['content-type'] = lookupMimeType(file.path);
|
headers['content-type'] = lookupMimeType(file.path);
|
||||||
headers['content-length'] = file.lengthSync().toString();
|
headers['content-length'] = file.lengthSync().toString();
|
||||||
|
|
||||||
if (streaming) {
|
if (!isBuffered) {
|
||||||
file.openRead().pipe(this);
|
file.openRead().pipe(this);
|
||||||
} else {
|
} else {
|
||||||
buffer.add(file.readAsBytesSync());
|
buffer.add(file.readAsBytesSync());
|
||||||
|
@ -128,7 +128,7 @@ abstract class ResponseContext<RawResponse>
|
||||||
///
|
///
|
||||||
/// This method should be overwritten, setting [streaming] to `false`, **after** a `super` call.
|
/// This method should be overwritten, setting [streaming] to `false`, **after** a `super` call.
|
||||||
Future close() {
|
Future close() {
|
||||||
if (streaming) {
|
if (!isBuffered) {
|
||||||
_buffer?.clear();
|
_buffer?.clear();
|
||||||
} else if (_buffer is _LockableBytesBuilder) {
|
} else if (_buffer is _LockableBytesBuilder) {
|
||||||
(_buffer as _LockableBytesBuilder)._lock();
|
(_buffer as _LockableBytesBuilder)._lock();
|
||||||
|
@ -340,13 +340,10 @@ abstract class ResponseContext<RawResponse>
|
||||||
void write(value, {Encoding encoding}) {
|
void write(value, {Encoding encoding}) {
|
||||||
encoding ??= utf8;
|
encoding ??= utf8;
|
||||||
|
|
||||||
if (!isOpen && !streaming)
|
if (!isOpen && isBuffered)
|
||||||
throw closed();
|
throw closed();
|
||||||
else if (streaming) {
|
else if (!isBuffered) {
|
||||||
if (value is List<int>)
|
add(encoding.encode(value.toString()));
|
||||||
add(value);
|
|
||||||
else
|
|
||||||
add(encoding.encode(value.toString()));
|
|
||||||
} else {
|
} else {
|
||||||
if (value is List<int>)
|
if (value is List<int>)
|
||||||
buffer.add(value);
|
buffer.add(value);
|
||||||
|
@ -357,9 +354,9 @@ abstract class ResponseContext<RawResponse>
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void writeCharCode(int charCode) {
|
void writeCharCode(int charCode) {
|
||||||
if (!isOpen && !streaming)
|
if (!isOpen && isBuffered)
|
||||||
throw closed();
|
throw closed();
|
||||||
else if (streaming)
|
else if (!isBuffered)
|
||||||
add([charCode]);
|
add([charCode]);
|
||||||
else
|
else
|
||||||
buffer.addByte(charCode);
|
buffer.addByte(charCode);
|
||||||
|
|
|
@ -30,7 +30,7 @@ class AngelHttp {
|
||||||
Future<HttpServer> Function(dynamic, int) _serverGenerator = HttpServer.bind;
|
Future<HttpServer> Function(dynamic, int) _serverGenerator = HttpServer.bind;
|
||||||
StreamSubscription<HttpRequest> _sub;
|
StreamSubscription<HttpRequest> _sub;
|
||||||
|
|
||||||
AngelHttp(this.app, {this.useZone: true});
|
AngelHttp(this.app, {this.useZone: false});
|
||||||
|
|
||||||
/// The function used to bind this instance to an HTTP server.
|
/// The function used to bind this instance to an HTTP server.
|
||||||
Future<HttpServer> Function(dynamic, int) get serverGenerator =>
|
Future<HttpServer> Function(dynamic, int) get serverGenerator =>
|
||||||
|
@ -62,7 +62,7 @@ class AngelHttp {
|
||||||
/// the server.
|
/// the server.
|
||||||
factory AngelHttp.secure(
|
factory AngelHttp.secure(
|
||||||
Angel app, String certificateChainPath, String serverKeyPath,
|
Angel app, String certificateChainPath, String serverKeyPath,
|
||||||
{ String password, bool useZone: true}) {
|
{String password, bool useZone: true}) {
|
||||||
var certificateChain =
|
var certificateChain =
|
||||||
Platform.script.resolve(certificateChainPath).toFilePath();
|
Platform.script.resolve(certificateChainPath).toFilePath();
|
||||||
var serverKey = Platform.script.resolve(serverKeyPath).toFilePath();
|
var serverKey = Platform.script.resolve(serverKeyPath).toFilePath();
|
||||||
|
@ -162,7 +162,15 @@ class AngelHttp {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useZone == false) {
|
if (useZone == false) {
|
||||||
return handle().catchError((e, StackTrace st) {
|
Future f;
|
||||||
|
|
||||||
|
try {
|
||||||
|
f = handle();
|
||||||
|
} catch (e, st) {
|
||||||
|
f = Future.error(e, st);
|
||||||
|
}
|
||||||
|
|
||||||
|
return f.catchError((e, StackTrace st) {
|
||||||
if (e is FormatException)
|
if (e is FormatException)
|
||||||
throw new AngelHttpException.badRequest(message: e.message)
|
throw new AngelHttpException.badRequest(message: e.message)
|
||||||
..stackTrace = st;
|
..stackTrace = st;
|
||||||
|
|
Loading…
Reference in a new issue