Skip to content

Commit

Permalink
Merge remote-tracking branch 'mmangino/master' into mmangino-merge
Browse files Browse the repository at this point in the history
Conflicts:
	Gemfile.lock
  • Loading branch information
jnunemaker committed Jun 6, 2011
2 parents 72886bc + b18c48f commit db6aeb2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/httparty/response.rb
Expand Up @@ -64,6 +64,11 @@ def inspect
klass === response
end
end

def respond_to?(name)
return true if [:request,:response,:parsed_response,:body,:headers].include?(name)
parsed_response.respond_to?(name) or response.respond_to?(name)
end

protected

Expand Down
5 changes: 5 additions & 0 deletions spec/httparty/response_spec.rb
Expand Up @@ -54,6 +54,11 @@
response = HTTParty::Response.new(@request_object, @response_object, {'foo' => 'bar'})
response['foo'].should == 'bar'
end

it "should respond_to? methods it supports" do
response = HTTParty::Response.new(@request_object, @response_object, {'foo' => 'bar'})
response.respond_to?(:parsed_response).should be_true
end

it "should be able to iterate if it is array" do
response = HTTParty::Response.new(@request_object, @response_object, [{'foo' => 'bar'}, {'foo' => 'baz'}])
Expand Down

0 comments on commit db6aeb2

Please sign in to comment.