mwunsch edited this page Apr 30, 2013 · 1 revision
Clone this wiki locally

An instance of Weary::Response is returned when the Request#requestperform method is called.

That's not exactly true. When Weary::Request#perform is called, it returns a Future wrapping a Response. Methods called on the Future delegate to the Response. The Response is simply a wrapper around a Rack::Response. Weary::Response, like most of the core classes in Weary, is a Rack application. It responds to a method call. A Weary::Response is simply a Rack application that returns itself when called.

It includes the Rack::Response::Helpers Module.

It has a method parse. If no body is present on the response, it will raise an Error. If parse is called without a block, it will call MultiJson.decode on the body, and throw an Error if the response Content-Type is not acceptable json. If parse is called with a block, it will yield the Response body and the Response Content-Type, allowing you to define your own parsing mechanism.