Module: RSpec::Httpd::Client::ResponseParser
- Defined in:
- lib/rspec/httpd/client.rb
Instance Attribute Summary collapse
-
#__response__ ⇒ Object
Returns the value of attribute __response__.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#__response__ ⇒ Object
Returns the value of attribute __response__.
120 121 122 |
# File 'lib/rspec/httpd/client.rb', line 120 def __response__ @__response__ end |
Class Method Details
.parse(response) ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/rspec/httpd/client.rb', line 106 def self.parse(response) content_type = response["content-type"] result = if content_type&.include?("application/json") JSON.parse(response.body) else response.body.force_encoding("utf-8").encode end result.extend(self) result.__response__ = response result end |
Instance Method Details
#status ⇒ Object
122 123 124 |
# File 'lib/rspec/httpd/client.rb', line 122 def status Integer(__response__.code) end |