Method: ActiveResource::Response#initialize
- Defined in:
- lib/active_resource/http_mock.rb
#initialize(body, message = 200, headers = {}) ⇒ Response
324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/active_resource/http_mock.rb', line 324 def initialize(body, = 200, headers = {}) @body, , @headers = body, .to_s, headers @code = [0, 3].to_i resp_cls = Net::HTTPResponse::CODE_TO_OBJ[@code.to_s] if resp_cls && !resp_cls.body_permitted? @body = nil end self["Content-Length"] = @body.nil? ? "0" : body.size.to_s end |