Class: Pact::Hal::HttpClient::Response
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Pact::Hal::HttpClient::Response
- Defined in:
- lib/pact/hal/http_client.rb
Instance Method Summary collapse
Instance Method Details
#body ⇒ Object
101 102 103 104 105 106 107 108 |
# File 'lib/pact/hal/http_client.rb', line 101 def body bod = raw_body if bod && bod != '' JSON.parse(bod) else nil end end |
#json? ⇒ Boolean
122 123 124 |
# File 'lib/pact/hal/http_client.rb', line 122 def json? self['content-type'] && self['content-type'] =~ /json/ end |
#raw_body ⇒ Object
110 111 112 |
# File 'lib/pact/hal/http_client.rb', line 110 def raw_body __getobj__().body end |
#status ⇒ Object
114 115 116 |
# File 'lib/pact/hal/http_client.rb', line 114 def status code.to_i end |
#success? ⇒ Boolean
118 119 120 |
# File 'lib/pact/hal/http_client.rb', line 118 def success? __getobj__().code.start_with?("2") end |