diff --git a/README.md b/README.md index 9179d255..a4476da9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # angel_framework -[![pub 1.0.0-dev.72](https://img.shields.io/badge/pub-1.0.0--dev.72-red.svg)](https://pub.dartlang.org/packages/angel_framework) +[![pub 1.0.0-dev.73](https://img.shields.io/badge/pub-1.0.0--dev.73-red.svg)](https://pub.dartlang.org/packages/angel_framework) [![build status](https://travis-ci.org/angel-dart/framework.svg)](https://travis-ci.org/angel-dart/framework) A high-powered HTTP server with support for dependency injection, sophisticated routing and more. diff --git a/lib/src/http/response_context.dart b/lib/src/http/response_context.dart index d71dafc9..bf39f553 100644 --- a/lib/src/http/response_context.dart +++ b/lib/src/http/response_context.dart @@ -34,13 +34,12 @@ class ResponseContext extends Extensible { final List cookies = []; /// Headers that will be sent to the user. - /// - /// If the response is closed, then this getter will return an immutable `Map`. Map get headers { - if (!_isOpen) + /// If the response is closed, then this getter will return an immutable `Map`. + /*if (!_isOpen) return new Map.unmodifiable(_headers); - else - return _headers; + else*/ + return _headers; } /// Serializes response data into a String. @@ -113,7 +112,7 @@ class ResponseContext extends Extensible { /// Sends a download as a response. download(File file, {String filename}) async { - if (!_isOpen) throw _closed(); + // if (!_isOpen) throw _closed(); headers["Content-Disposition"] = 'attachment; filename="${filename ?? file.path}"'; @@ -151,7 +150,7 @@ class ResponseContext extends Extensible { /// Returns a JSONP response. void jsonp(value, {String callbackName: "callback", contentType}) { - if (!_isOpen) throw _closed(); + // if (!_isOpen) throw _closed(); write("$callbackName(${serializer(value)})"); if (contentType != null) { @@ -167,7 +166,7 @@ class ResponseContext extends Extensible { /// Renders a view to the response stream, and closes the response. Future render(String view, [Map data]) async { - if (!_isOpen) throw _closed(); + // if (!_isOpen) throw _closed(); write(await app.viewGenerator(view, data)); headers[HttpHeaders.CONTENT_TYPE] = ContentType.HTML.toString(); end(); @@ -181,7 +180,7 @@ class ResponseContext extends Extensible { /// /// See [Router]#navigate for more. :) void redirect(url, {bool absolute: true, int code: 302}) { - if (!_isOpen) throw _closed(); + // if (!_isOpen) throw _closed(); headers[HttpHeaders.LOCATION] = url is String ? url : app.navigate(url, absolute: absolute); statusCode = code ?? 302; @@ -207,7 +206,7 @@ class ResponseContext extends Extensible { /// Redirects to the given named [Route]. void redirectTo(String name, [Map params, int code]) { - if (!_isOpen) throw _closed(); + // if (!_isOpen) throw _closed(); Route _findRoute(Router r) { for (Route route in r.routes) { if (route is SymlinkRoute) { @@ -232,7 +231,7 @@ class ResponseContext extends Extensible { /// Redirects to the given [Controller] action. void redirectToAction(String action, [Map params, int code]) { - if (!_isOpen) throw _closed(); + // if (!_isOpen) throw _closed(); // UserController@show List split = action.split("@"); @@ -262,7 +261,7 @@ class ResponseContext extends Extensible { /// Copies a file's contents into the response buffer. Future sendFile(File file, {int chunkSize, int sleepMs: 0, bool resumable: true}) async { - if (!_isOpen) throw _closed(); + // if (!_isOpen) throw _closed(); headers[HttpHeaders.CONTENT_TYPE] = lookupMimeType(file.path); buffer.add(await file.readAsBytes()); @@ -273,7 +272,7 @@ class ResponseContext extends Extensible { /// /// [contentType] can be either a [String], or a [ContentType]. void serialize(value, {contentType}) { - if (!_isOpen) throw _closed(); + // if (!_isOpen) throw _closed(); var text = serializer(value); write(text); @@ -292,7 +291,7 @@ class ResponseContext extends Extensible { int sleepMs: 0, bool resumable: true, Codec, List> codec}) async { - if (!_isOpen) throw _closed(); + // if (!_isOpen) throw _closed(); headers[HttpHeaders.CONTENT_TYPE] = lookupMimeType(file.path); end(); @@ -332,7 +331,7 @@ class _LockableBytesBuilderImpl implements _LockableBytesBuilder { @override void _lock() { - _closed = true; + // _closed = true; } @override diff --git a/pubspec.yaml b/pubspec.yaml index 4f865bfb..4b2de8eb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: angel_framework -version: 1.0.0-dev.72 +version: 1.0.0-dev.73 description: A high-powered HTTP server with DI, routing and more. author: Tobe O homepage: https://github.com/angel-dart/angel_framework