Class: Rack::Client::Parser::Response

Inherits:
Response
  • Object
show all
Defined in:
lib/rack/client/parser/response.rb

Instance Method Summary collapse

Methods inherited from Response

#initialize

Constructor Details

This class inherits a constructor from Rack::Client::Response

Instance Method Details

#finishObject



5
6
7
8
9
# File 'lib/rack/client/parser/response.rb', line 5

def finish(*)
  super
ensure
  parse_body_as(headers['Content-Type']) if headers['Content-Type']
end

#parse_body_as(content_type) ⇒ Object



11
12
13
14
15
# File 'lib/rack/client/parser/response.rb', line 11

def parse_body_as(content_type)
  if parser = Base.lookup(content_type)
    headers['rack-client.body_collection'] = parser.new.decode(body)
  end
end