Class | ActiveResource::Response |
In: |
vendor/rails/activeresource/lib/active_resource/http_mock.rb
|
Parent: | Object |
body | [RW] | |
code | [RW] | |
headers | [RW] | |
message | [RW] |
# File vendor/rails/activeresource/lib/active_resource/http_mock.rb, line 105 105: def initialize(body, message = 200, headers = {}) 106: @body, @message, @headers = body, message.to_s, headers 107: @code = @message[0,3].to_i 108: 109: resp_cls = Net::HTTPResponse::CODE_TO_OBJ[@code.to_s] 110: if resp_cls && !resp_cls.body_permitted? 111: @body = nil 112: end 113: 114: if @body.nil? 115: self['Content-Length'] = "0" 116: else 117: self['Content-Length'] = body.size.to_s 118: end 119: end
# File vendor/rails/activeresource/lib/active_resource/http_mock.rb, line 133 133: def ==(other) 134: if (other.is_a?(Response)) 135: other.body == body && other.message == message && other.headers == headers 136: else 137: false 138: end 139: end
# File vendor/rails/activeresource/lib/active_resource/http_mock.rb, line 125 125: def [](key) 126: headers[key] 127: end
# File vendor/rails/activeresource/lib/active_resource/http_mock.rb, line 129 129: def []=(key, value) 130: headers[key] = value 131: end