diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml
index f73ff04c..576ef34c 100644
--- a/.idea/libraries/Dart_Packages.xml
+++ b/.idea/libraries/Dart_Packages.xml
@@ -26,14 +26,14 @@
-
+
-
+
@@ -47,7 +47,7 @@
-
+
@@ -82,7 +82,7 @@
-
+
@@ -138,7 +138,7 @@
-
+
@@ -173,7 +173,7 @@
-
+
@@ -236,7 +236,7 @@
-
+
@@ -247,6 +247,13 @@
+
+
+
+
+
+
+
@@ -285,7 +292,7 @@
-
+
@@ -310,10 +317,17 @@
+
+
+
+
+
+
+
-
+
@@ -327,7 +341,7 @@
-
+
@@ -369,7 +383,7 @@
-
+
@@ -390,7 +404,7 @@
-
+
@@ -418,7 +432,7 @@
-
+
@@ -442,15 +456,15 @@
-
-
+
+
-
+
-
+
@@ -458,12 +472,12 @@
-
+
-
+
@@ -472,33 +486,35 @@
-
+
+
-
+
-
+
+
-
+
-
+
-
+
-
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 6d676c6e..492c51a5 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,7 +1,8 @@
-
+
+
@@ -31,7 +32,7 @@
-
+
@@ -41,17 +42,30 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -60,11 +74,11 @@
-
+
-
-
+
+
@@ -121,7 +135,7 @@
-
+
@@ -279,9 +293,9 @@
DEFINITION_ORDER
-
+
-
+
@@ -309,31 +323,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -674,7 +670,9 @@
-
+
+
+
1481237183504
@@ -998,7 +996,14 @@
1513103332618
-
+
+ 1513103639013
+
+
+
+ 1513103639013
+
+
@@ -1034,7 +1039,7 @@
-
+
@@ -1046,31 +1051,33 @@
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -1090,7 +1097,6 @@
-
@@ -1115,7 +1121,8 @@
-
+
+
@@ -1398,7 +1405,7 @@
-
+
@@ -1445,9 +1452,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -1455,26 +1488,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -1482,24 +1499,14 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c5c253e8..4377d9a0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 1.1.1
+* `ResponseContext` no longer automatically closes if `serializer` returns an
+empty string.
+
# 1.1.0+3
* Modified `ResponseContext#isOpen` to also return `false` if streaming is being used.
diff --git a/lib/src/http/response_context.dart b/lib/src/http/response_context.dart
index bde72914..c6d80a0b 100644
--- a/lib/src/http/response_context.dart
+++ b/lib/src/http/response_context.dart
@@ -308,11 +308,15 @@ class ResponseContext implements StreamSink>, StringSink {
void serialize(value, {contentType}) {
if (_isClosed) throw _closed();
+ var text = serializer(value);
+
+ if (text.isEmpty)
+ return;
+
if (contentType is String)
headers[HttpHeaders.CONTENT_TYPE] = contentType;
else if (contentType is ContentType) this.contentType = contentType;
- var text = serializer(value);
write(text);
end();
diff --git a/pubspec.yaml b/pubspec.yaml
index 6047fced..7eca6daf 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -20,6 +20,7 @@ dependencies:
mime: ^0.9.3
pool: ^1.0.0
random_string: ^0.0.1
+ recase: ^1.0.0
tuple: ^1.0.0
dev_dependencies:
mock_request: ^1.0.0