fix unknown mime type errors
This commit is contained in:
parent
a581e272ac
commit
2991c723eb
21
config/initializers/mime_type_fix.rb
Normal file
21
config/initializers/mime_type_fix.rb
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
module ActionDispatch
|
||||||
|
module Http
|
||||||
|
module MimeNegotiation
|
||||||
|
|
||||||
|
# Patched to always accept at least HTML
|
||||||
|
def accepts
|
||||||
|
@env["action_dispatch.request.accepts"] ||= begin
|
||||||
|
header = @env['HTTP_ACCEPT'].to_s.strip
|
||||||
|
|
||||||
|
if header.empty?
|
||||||
|
[content_mime_type]
|
||||||
|
else
|
||||||
|
Mime::Type.parse(header) << Mime::HTML
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user