Permalink
Browse files

Merge pull request #10297 from vipulnsward/dont_mutate_in_rack_response

extract no content response codes to a constant
  • Loading branch information...
pixeltrix committed Apr 22, 2013
2 parents 07acf7b + 5fe6829 commit 8758c6c6e31162b87ca6b9a43e7f2a91cc3ad2d3
Showing with 2 additions and 1 deletion.
  1. +2 −1 actionpack/lib/action_dispatch/http/response.rb
@@ -55,6 +55,7 @@ class Response
CONTENT_TYPE = "Content-Type".freeze
SET_COOKIE = "Set-Cookie".freeze
LOCATION = "Location".freeze
+ NO_CONTENT_CODES = [204, 304]
cattr_accessor(:default_charset) { "utf-8" }
cattr_accessor(:default_headers)
@@ -289,7 +290,7 @@ def rack_response(status, header)
header[SET_COOKIE] = header[SET_COOKIE].join("\n") if header[SET_COOKIE].respond_to?(:join)
- if [204, 304].include?(@status)
+ if NO_CONTENT_CODES.include?(@status)
header.delete CONTENT_TYPE
[status, header, []]
else

0 comments on commit 8758c6c

Please sign in to comment.