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__.
127 128 129 |
# File 'lib/rspec/httpd/client.rb', line 127 def __response__ @__response__ end |
Class Method Details
.parse(response) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/rspec/httpd/client.rb', line 111 def self.parse(response) return nil if response.body.nil? 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
129 130 131 |
# File 'lib/rspec/httpd/client.rb', line 129 def status Integer(__response__.code) end |