Sha256: e865c7a6ac7efdd1bcaf0e9c53ccdd7c066daec8fdcd2b8489e32b398bfd4b9b
Contents?: true
Size: 461 Bytes
Versions: 8
Compression:
Stored size: 461 Bytes
Contents
module Olelo module Middleware class DegradeMimeType def initialize(app) @app = app end def call(env) status, header, body = @app.call(env) if env['HTTP_ACCEPT'].to_s !~ %r{application/xhtml\+xml} if header['Content-Type'] =~ %r{\Aapplication/xhtml\+xml(;?.*)\Z} header['Content-Type'] = "text/html#{$1}" end end [status, header, body] end end end end
Version data entries
8 entries across 8 versions & 1 rubygems