diff --git a/lib/src/http/response_context.dart b/lib/src/http/response_context.dart index 37d94292..50488ace 100644 --- a/lib/src/http/response_context.dart +++ b/lib/src/http/response_context.dart @@ -19,6 +19,9 @@ class ResponseContext extends Extensible { /// The [Angel] instance that is sending a response. AngelBase app; + /// Is `Transfer-Encoding` chunked? + bool chunked; + /// Any and all cookies to be sent to the user. final List cookies = []; diff --git a/lib/src/http/server.dart b/lib/src/http/server.dart index dd4adaa3..a0d08df0 100644 --- a/lib/src/http/server.dart +++ b/lib/src/http/server.dart @@ -254,6 +254,8 @@ class Angel extends AngelBase { for (var key in res.headers.keys) { request.response.headers.set(key, res.headers[key]); } + + request.response.headers.chunkedTransferEncoding = res.chunked ?? true; request.response ..statusCode = res.statusCode diff --git a/test/di_test.dart b/test/di_test.dart index 7b8599e9..82ddecb3 100644 --- a/test/di_test.dart +++ b/test/di_test.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:angel_framework/angel_framework.dart'; +import 'package:angel_route/angel_route.dart'; import 'package:http/http.dart' as http; import 'package:test/test.dart'; import 'common.dart'; @@ -77,9 +78,8 @@ class SingletonController extends Controller { @Expose("/errands4") class ErrandController extends Controller { @Expose("/") - errand(Errand errand, Match match) { - expect(match, isNotNull); - print('Match: ${match.group(0)}'); + errand(Errand errand, MiddlewarePipeline pipeline) { + expect(pipeline, isNotNull); return errand.text; } }