summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStormwind <stormwind@stormwinds-page.de>2012-11-23 21:24:37 +0100
committerStormwind <stormwind@stormwinds-page.de>2012-11-23 21:24:37 +0100
commitbffdca6cb18280442996e0c753afe14ca331cad5 (patch)
treec3b357080d5821b6d06a1906f2f471d900eec68e /lib
parentfea8ac2bbd04fd4abea929fef1b7e8ac305b4ca1 (diff)
Delete Content-Length. Conten-Type and body on status 204
Should work, but somehow it doesn't...
Diffstat (limited to 'lib')
-rw-r--r--lib/zero/response.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/zero/response.rb b/lib/zero/response.rb
index fefa320..c86e5df 100644
--- a/lib/zero/response.rb
+++ b/lib/zero/response.rb
@@ -30,12 +30,18 @@ module Zero
#
# @return [Array]
#
- def to_a()
+ def to_a
# TODO Remove content length and body, on certain status codes
- # Set content length, if not already set
- content_length unless header.has_key? 'Content-Length'
- # Set content type, if not already set
- content_type 'text/html' unless header.has_key? 'Content-Type'
+ if status == 204
+ header.delete('Content-Length')
+ header.delete('Content-Type')
+ body = []
+ else
+ # Set content length, if not already set
+ content_length unless header.has_key? 'Content-Length'
+ # Set content type, if not already set
+ content_type 'text/html' unless header.has_key? 'Content-Type'
+ end
[status, header, body]
end