diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e36273c9..564643a6 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,7 +3,7 @@
-
+
@@ -26,69 +26,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -104,8 +53,8 @@
-
-
+
+
@@ -113,6 +62,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -143,8 +104,6 @@
- Map<String,
- as
redirectTo
finalizers.t
`Iterable`
@@ -173,9 +132,10 @@
package:dart:io
deprecated
parse
+ io.
+ io
- appa
isClosed
useStream
streaming
@@ -205,6 +165,7 @@
dart:convert
dart:io
json.decode
+ rawRequest.
C:\Users\thosa\Source\Angel\framework\lib
@@ -228,7 +189,6 @@
@@ -697,21 +658,7 @@
-
-
-
- 1526440683707
-
-
-
- 1526440683707
-
-
- 1528441794043
-
-
-
- 1528441794044
+
1528442409476
@@ -1042,7 +989,21 @@
1534735654118
-
+
+ 1534735707304
+
+
+
+ 1534735707304
+
+
+ 1534735919739
+
+
+
+ 1534735919739
+
+
@@ -1078,7 +1039,7 @@
-
+
@@ -1141,7 +1102,6 @@
-
@@ -1166,7 +1126,8 @@
-
+
+
@@ -1174,13 +1135,6 @@
-
-
-
-
-
-
-
@@ -1462,13 +1416,6 @@
-
-
-
-
-
-
-
@@ -1476,30 +1423,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1528,16 +1451,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -1548,12 +1461,29 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
@@ -1561,13 +1491,53 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/src/core/response_context.dart b/lib/src/core/response_context.dart
index 0314c3da..fa3d5482 100644
--- a/lib/src/core/response_context.dart
+++ b/lib/src/core/response_context.dart
@@ -3,7 +3,7 @@ library angel_framework.http.response_context;
import 'dart:async';
import 'dart:convert';
import 'dart:convert' as c show json;
-import 'dart:io' show BytesBuilder, Cookie, HttpResponse;
+import 'dart:io' show BytesBuilder, Cookie;
import 'package:angel_route/angel_route.dart';
import 'package:file/file.dart';
@@ -18,7 +18,7 @@ import 'server.dart' show Angel;
final RegExp _straySlashes = new RegExp(r'(^/+)|(/+$)');
/// A convenience wrapper around an outgoing HTTP request.
-abstract class ResponseContext implements StreamSink>, StringSink {
+abstract class ResponseContext implements StreamSink>, StringSink {
final Map properties = {};
final BytesBuilder _buffer = new _LockableBytesBuilder();
final Map _headers = {'server': 'angel'};
@@ -93,8 +93,8 @@ abstract class ResponseContext implements StreamSink>, StringSink {
/// A set of UTF-8 encoded bytes that will be written to the response.
BytesBuilder get buffer => _buffer;
- /// The underlying [HttpResponse] under this instance.
- HttpResponse get io;
+ /// The underlying [RawResponse] under this instance.
+ RawResponse get rawResponse;
/// Gets or sets the content type to send back to a client.
MediaType contentType = new MediaType('text', 'plain');
@@ -305,11 +305,8 @@ abstract class ResponseContext implements StreamSink>, StringSink {
}
/// Streams a file to this response.
- ///
- /// You can optionally transform the file stream with a [codec].
Future streamFile(File file) {
if (!isOpen) throw closed();
-
headers['content-type'] = lookupMimeType(file.path);
return file.openRead().pipe(this);
}
diff --git a/lib/src/http/http_response_context.dart b/lib/src/http/http_response_context.dart
index a6f200ba..6cd2ab13 100644
--- a/lib/src/http/http_response_context.dart
+++ b/lib/src/http/http_response_context.dart
@@ -4,16 +4,16 @@ import 'dart:io';
import '../core/core.dart';
import 'http_request_context.dart';
-class HttpResponseContextImpl extends ResponseContext {
+class HttpResponseContextImpl extends ResponseContext {
/// The underlying [HttpResponse] under this instance.
@override
- final HttpResponse io;
+ final HttpResponse rawResponse;
Angel app;
final HttpRequestContextImpl _correspondingRequest;
bool _isClosed = false, _useStream = false;
- HttpResponseContextImpl(this.io, this.app, [this._correspondingRequest]);
+ HttpResponseContextImpl(this.rawResponse, this.app, [this._correspondingRequest]);
@override
RequestContext get correspondingRequest {
@@ -32,7 +32,7 @@ class HttpResponseContextImpl extends ResponseContext {
@override
void addError(Object error, [StackTrace stackTrace]) {
- io.addError(error, stackTrace);
+ rawResponse.addError(error, stackTrace);
super.addError(error, stackTrace);
}
@@ -41,10 +41,10 @@ class HttpResponseContextImpl extends ResponseContext {
if (!_useStream) {
// If this is the first stream added to this response,
// then add headers, status code, etc.
- io
+ rawResponse
..statusCode = statusCode
..cookies.addAll(cookies);
- headers.forEach(io.headers.set);
+ headers.forEach(rawResponse.headers.set);
willCloseItself = _useStream = _isClosed = true;
releaseCorrespondingRequest();
return true;
@@ -92,7 +92,7 @@ class HttpResponseContextImpl extends ResponseContext {
if (encoder != null) {
if (firstStream) {
- io.headers.set('content-encoding', key);
+ rawResponse.headers.set('content-encoding', key);
}
output = encoders[key].bind(output);
@@ -102,7 +102,7 @@ class HttpResponseContextImpl extends ResponseContext {
}
}
- return io.addStream(output);
+ return rawResponse.addStream(output);
}
@override
@@ -110,7 +110,7 @@ class HttpResponseContextImpl extends ResponseContext {
if (_isClosed && !_useStream)
throw ResponseContext.closed();
else if (_useStream)
- io.add(data);
+ rawResponse.add(data);
else
buffer.add(data);
}
@@ -119,7 +119,7 @@ class HttpResponseContextImpl extends ResponseContext {
Future close() {
if (_useStream) {
try {
- io.close();
+ rawResponse.close();
} catch (_) {
// This only seems to occur on `MockHttpRequest`, but
// this try/catch prevents a crash.