Sha256: 4bef193ead142fc492a9fa752a52e7c3a13dbf82f4296fcab9467bf8f19cd39f

Contents?: true

Size: 599 Bytes

Versions: 7

Compression:

Stored size: 599 Bytes

Contents

# Takes care of ensuring the Content-Type is set to application/xhtml+xml
# for docomo devices as is required to use xhtml instead of text/html.  If
# text/html is used, the content is rendered as the vastly inferior i-mode
# html (aka CHTML).
class Galakei::Filter::ContentType < Galakei::Filter::Base
  # :stopdoc:
  def condition?
    request.docomo? && %r{text/html} =~ response.content_type
  end

  def filter
    Rails.logger.debug("[galakei] DoCoMo browser 1.0 and HTML detected, changing content type to application/xhtml+xml")
    response.content_type = 'application/xhtml+xml'
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
galakei-0.13.7 lib/galakei/filter/content_type.rb
galakei-0.13.6 lib/galakei/filter/content_type.rb
galakei-0.13.5 lib/galakei/filter/content_type.rb
galakei-0.13.4 lib/galakei/filter/content_type.rb
galakei-0.13.3 lib/galakei/filter/content_type.rb
galakei-0.13.2 lib/galakei/filter/content_type.rb
galakei-0.13.1 lib/galakei/filter/content_type.rb