aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/response.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch/http/response.rb')
-rw-r--r--actionpack/lib/action_dispatch/http/response.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb
index cbeea9e267..de3ca7d095 100644
--- a/actionpack/lib/action_dispatch/http/response.rb
+++ b/actionpack/lib/action_dispatch/http/response.rb
@@ -348,6 +348,7 @@ module ActionDispatch # :nodoc:
return if committed?
assign_default_content_type_and_charset!
handle_conditional_get!
+ handle_no_content!
end
def before_sending
@@ -405,10 +406,15 @@ module ActionDispatch # :nodoc:
end
end
+ def handle_no_content!
+ if NO_CONTENT_CODES.include?(@status)
+ @header.delete CONTENT_TYPE
+ @header.delete 'Content-Length'
+ end
+ end
+
def rack_response(status, header)
if NO_CONTENT_CODES.include?(status)
- header.delete CONTENT_TYPE
- header.delete 'Content-Length'
[status, header, []]
else
[status, header, RackBody.new(self)]