Sha256: 84a95347e31f291af3ddb06f60e57c381b03e4516e9dc356dd03905b46f042f3
Contents?: true
Size: 624 Bytes
Versions: 12
Compression:
Stored size: 624 Bytes
Contents
# frozen_string_literal: true module RailsMiniProfiler class ResponseWrapper attr_reader :response, :rack_response delegate :status, :headers, to: :rack_response def initialize(status, headers, response) @rack_response = Rack::Response.new(response, status, headers) @response = response end def body return '' unless json? || xml? response&.body || '' end def media_type @media_type ||= @rack_response.media_type end def json? media_type =~ %r{application/json} end def xml? media_type =~ %r{application/xml} end end end
Version data entries
12 entries across 12 versions & 1 rubygems