Permalink
Browse files

Use MultiXML and MultiJSON for parsing instead of Crack

  • Loading branch information...
1 parent 2d2856b commit 05cacfee9e207d86313ffb02b3e57d896d3252f4 @bfrydl bfrydl committed Jul 7, 2011
Showing with 10 additions and 6 deletions.
  1. +2 −0 httparty.gemspec
  2. +2 −0 lib/httparty.rb
  3. +2 −2 lib/httparty/parser.rb
  4. +4 −4 spec/httparty/parser_spec.rb
View
@@ -13,6 +13,8 @@ Gem::Specification.new do |s|
s.description = %q{Makes http fun! Also, makes consuming restful web services dead easy.}
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 "cucumber", "~> 0.7"
View
@@ -4,6 +4,8 @@
require 'uri'
require 'zlib'
require 'crack'
+require 'multi_xml'
+require 'multi_json'
require 'httparty/module_inheritable_attributes'
require 'httparty/cookie_hash'
View
@@ -109,11 +109,11 @@ def parse
protected
def xml
- Crack::XML.parse(body)
+ MultiXml.parse(body)
end
def json
- Crack::JSON.parse(body)
+ MultiJson.decode(body)
end
def yaml
@@ -129,13 +129,13 @@ def self.name; 'AtomParser'; end
HTTParty::Parser.new('body', nil)
end
- it "parses xml with Crack" do
- Crack::XML.should_receive(:parse).with('body')
+ it "parses xml with MultiXml" do
+ MultiXml.should_receive(:parse).with('body')
subject.send(:xml)
end
- it "parses json with Crack" do
- Crack::JSON.should_receive(:parse).with('body')
+ it "parses json with MultiJson" do
+ MultiJson.should_receive(:decode).with('body')
subject.send(:json)
end

0 comments on commit 05cacfe

Please sign in to comment.