Class: HttpResponseImpl
- Inherits:
-
Object
show all
- Defined in:
- lib/resurfaceio/http_response_impl.rb
Overview
© 2016-2021 Resurface Labs Inc.
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of HttpResponseImpl.
6
7
8
9
|
# File 'lib/resurfaceio/http_response_impl.rb', line 6
def initialize
@headers = Hash.new
@raw_body = nil
end
|
Instance Attribute Details
#raw_body ⇒ Object
Returns the value of attribute raw_body.
38
39
40
|
# File 'lib/resurfaceio/http_response_impl.rb', line 38
def raw_body
@raw_body
end
|
#status ⇒ Object
Returns the value of attribute status.
39
40
41
|
# File 'lib/resurfaceio/http_response_impl.rb', line 39
def status
@status
end
|
Instance Method Details
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/resurfaceio/http_response_impl.rb', line 11
def (key, value)
unless value.nil?
existing = @headers[key]
if existing.nil?
@headers[key] = value
else
@headers[key] = "#{existing}, #{value}"
end
end
end
|
#body ⇒ Object
22
23
24
|
# File 'lib/resurfaceio/http_response_impl.rb', line 22
def body
@raw_body ? [@raw_body] : nil
end
|
#content_type ⇒ Object
26
27
28
|
# File 'lib/resurfaceio/http_response_impl.rb', line 26
def content_type
@headers['Content-Type']
end
|
#content_type=(content_type) ⇒ Object
30
31
32
|
# File 'lib/resurfaceio/http_response_impl.rb', line 30
def content_type=(content_type)
@headers['Content-Type'] = content_type
end
|
34
35
36
|
# File 'lib/resurfaceio/http_response_impl.rb', line 34
def
@headers
end
|