Class: Blix::Rest::HtmlFormatParser

Inherits:
FormatParser show all
Defined in:
lib/blix/rest/format_parser.rb

Overview


the default html format parser

Instance Attribute Summary

Attributes inherited from FormatParser

#__custom_headers, #_format, #_options

Instance Method Summary collapse

Methods inherited from FormatParser

_types, #_types, accept_types

Instance Method Details

#format_error(message) ⇒ Object



158
159
160
161
162
163
164
165
166
167
# File 'lib/blix/rest/format_parser.rb', line 158

def format_error(message)
  %(
    <html>
    <head></head>
    <body>
    <p>#{message}</p>
    </body>
    </html>
  )
end

#format_response(value, response) ⇒ Object



169
170
171
# File 'lib/blix/rest/format_parser.rb', line 169

def format_response(value, response)
  response.content = [value.to_s]
end

#set_default_headers(headers) ⇒ Object



146
147
148
149
150
151
152
153
154
155
156
# File 'lib/blix/rest/format_parser.rb', line 146

def set_default_headers(headers)
  headers[CACHE_CONTROL] = CACHE_NO_STORE
  headers[PRAGMA]        = NO_CACHE
  headers[CONTENT_TYPE]  = CONTENT_TYPE_HTML
  # headers['X-Frame-Options']        =  'SAMEORIGIN'
  # headers['X-XSS-Protection']       =  '1; mode=block'
  # headers['X-Content-Type-Options'] =  'nosniff'
  # headers['X-Download-Options']     =  'noopen'
  # headers['X-Permitted-Cross-Domain-Policies'] =  'none'
  # headers['Referrer-Policy']        =  'strict-origin-when-cross-origin'
end