Sha256: 2a6a06255f25cf3f51dfac8a434196ff4a3f8feb05618f4599f81d8989f6fbbc
Contents?: true
Size: 593 Bytes
Versions: 13
Compression:
Stored size: 593 Bytes
Contents
module Murlsh # Set the content type correctly based on accept header and user agent. class XhtmlResponse < Rack::Response # Set the content type to application/xhtml+xml for anything that # claims to accept it, for anything else or IE use text/html. def set_content_type(http_accept, http_user_agent) self['Content-Type'] = if http_accept and http_accept[/((\*|application)\/\*|application\/xhtml\+xml)/i] and (!http_user_agent or !http_user_agent[/ msie /i]) 'application/xhtml+xml' else 'text/html' end end end end
Version data entries
13 entries across 13 versions & 1 rubygems