class RailsMiniProfiler::ResponseWrapper
Attributes
rack_response[R]
response[R]
Public Class Methods
new(status, headers, response)
click to toggle source
# File lib/rails_mini_profiler/response_wrapper.rb, line 9 def initialize(status, headers, response) @rack_response = Rack::Response.new(response, status, headers) @response = response end
Public Instance Methods
body()
click to toggle source
# File lib/rails_mini_profiler/response_wrapper.rb, line 14 def body return '' unless json? || xml? response&.body || '' end
json?()
click to toggle source
# File lib/rails_mini_profiler/response_wrapper.rb, line 24 def json? media_type =~ %r{application/json} end
media_type()
click to toggle source
# File lib/rails_mini_profiler/response_wrapper.rb, line 20 def media_type @media_type ||= @rack_response.media_type end
xml?()
click to toggle source
# File lib/rails_mini_profiler/response_wrapper.rb, line 28 def xml? media_type =~ %r{application/xml} end