aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-12-09 14:29:06 -0500
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-12-09 14:39:43 -0500
commit4eb3ef812ce0610912fe67c4f4b048b38b0c0213 (patch)
treee6aedfaed4ef3fa1335041f7825f7d206d68a531 /actionpack/lib/action_dispatch
parenta9d72f6e47d42ce2b9f7ad9f957ef1bd4bb6c800 (diff)
downloadrails-4eb3ef812ce0610912fe67c4f4b048b38b0c0213.tar.gz
rails-4eb3ef812ce0610912fe67c4f4b048b38b0c0213.tar.bz2
rails-4eb3ef812ce0610912fe67c4f4b048b38b0c0213.zip
Do not raise exception when content_type is a empty string
When content type header is blank we were raising an exception because `empty?` was being called on nil.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/http/response.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb
index 357ca56036..f71c6afd6c 100644
--- a/actionpack/lib/action_dispatch/http/response.rb
+++ b/actionpack/lib/action_dispatch/http/response.rb
@@ -408,7 +408,7 @@ module ActionDispatch # :nodoc:
def parse_content_type(content_type)
if content_type
type, charset = content_type.split(/;\s*charset=/)
- type = nil if type.empty?
+ type = nil if type && type.empty?
ContentTypeHeader.new(type, charset)
else
NullContentTypeHeader