Sha256: 07a7573a7f9f9e7d41f5ac101975d5dfb151bae86655437c494f1b41896c4dd0

Contents?: true

Size: 518 Bytes

Versions: 4

Compression:

Stored size: 518 Bytes

Contents

module Murlsh

  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

4 entries across 4 versions & 1 rubygems

Version Path
murlsh-0.2.4 lib/murlsh/xhtml_response.rb
murlsh-0.2.3 lib/murlsh/xhtml_response.rb
murlsh-0.2.2 lib/murlsh/xhtml_response.rb
murlsh-0.2.1 lib/murlsh/xhtml_response.rb