Class: Papertrail::HttpResponse

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/papertrail/http_client.rb

Overview

Used because Net::HTTPOK in Ruby 1.8 has no body= method

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ HttpResponse

Returns a new instance of HttpResponse.


9
10
11
# File 'lib/papertrail/http_client.rb', line 9

def initialize(response)
  super(response)
end

Instance Method Details

#bodyObject


17
18
19
20
21
22
23
# File 'lib/papertrail/http_client.rb', line 17

def body
  if __getobj__.body.respond_to?(:force_encoding)
    @body ||= Papertrail::OkJson.decode(__getobj__.body.dup.force_encoding('UTF-8'))
  else
    @body ||= Papertrail::OkJson.decode(__getobj__.body.dup)
  end
end