aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/mime_type.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch/http/mime_type.rb')
-rw-r--r--actionpack/lib/action_dispatch/http/mime_type.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/mime_type.rb b/actionpack/lib/action_dispatch/http/mime_type.rb
index f56f09c5b3..912da741b7 100644
--- a/actionpack/lib/action_dispatch/http/mime_type.rb
+++ b/actionpack/lib/action_dispatch/http/mime_type.rb
@@ -27,7 +27,7 @@ module Mime
class << self
def [](type)
return type if type.is_a?(Type)
- Type.lookup_by_extension(type)
+ Type.lookup_by_extension(type) || NullType.new
end
def fetch(type)
@@ -306,6 +306,17 @@ module Mime
method.to_s.ends_with? '?'
end
end
+
+ class NullType
+ def nil?
+ true
+ end
+
+ private
+ def method_missing(method, *args)
+ false if method.to_s.ends_with? '?'
+ end
+ end
end
require 'action_dispatch/http/mime_types'