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