1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00

Merge branch 'master' of https://github.com/bfrydl/httparty into bfrydl-master

This commit is contained in:
John Nunemaker 2011-09-13 11:53:53 -04:00
commit 7788ac9479
4 changed files with 10 additions and 6 deletions

View file

@ -13,6 +13,8 @@ Gem::Specification.new do |s|
s.description = %q{Makes http fun! Also, makes consuming restful web services dead easy.} s.description = %q{Makes http fun! Also, makes consuming restful web services dead easy.}
s.add_dependency 'crack', HTTParty::CRACK_DEPENDENCY s.add_dependency 'crack', HTTParty::CRACK_DEPENDENCY
s.add_dependency 'multi_json'
s.add_dependency 'multi_xml'
s.add_development_dependency "activesupport", "~> 2.3" s.add_development_dependency "activesupport", "~> 2.3"
s.add_development_dependency "cucumber", "~> 0.7" s.add_development_dependency "cucumber", "~> 0.7"

View file

@ -4,6 +4,8 @@ require 'net/https'
require 'uri' require 'uri'
require 'zlib' require 'zlib'
require 'crack' require 'crack'
require 'multi_xml'
require 'multi_json'
require 'httparty/module_inheritable_attributes' require 'httparty/module_inheritable_attributes'
require 'httparty/cookie_hash' require 'httparty/cookie_hash'

View file

@ -109,11 +109,11 @@ module HTTParty
protected protected
def xml def xml
Crack::XML.parse(body) MultiXml.parse(body)
end end
def json def json
Crack::JSON.parse(body) MultiJson.decode(body)
end end
def yaml def yaml

View file

@ -129,13 +129,13 @@ describe HTTParty::Parser do
HTTParty::Parser.new('body', nil) HTTParty::Parser.new('body', nil)
end end
it "parses xml with Crack" do it "parses xml with MultiXml" do
Crack::XML.should_receive(:parse).with('body') MultiXml.should_receive(:parse).with('body')
subject.send(:xml) subject.send(:xml)
end end
it "parses json with Crack" do it "parses json with MultiJson" do
Crack::JSON.should_receive(:parse).with('body') MultiJson.should_receive(:decode).with('body')
subject.send(:json) subject.send(:json)
end end