mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Replace multi_json gem with stdlib JSON.
As of June 2013, multi_json will no longer be maintained.
This commit is contained in:
parent
82e351f090
commit
1f7ab6a120
6 changed files with 6 additions and 18 deletions
1
Gemfile
1
Gemfile
|
@ -6,7 +6,6 @@ gem 'cucumber', '~> 0.7'
|
|||
gem 'fakeweb', '~> 1.2'
|
||||
gem 'rspec', '~> 1.3'
|
||||
gem 'mongrel', '1.2.0.pre2'
|
||||
gem 'multi_json', '~> 1.3'
|
||||
|
||||
group :development do
|
||||
gem 'guard'
|
||||
|
|
|
@ -10,7 +10,8 @@ gem install httparty
|
|||
|
||||
## Requirements
|
||||
|
||||
* multi_json and multi_xml
|
||||
* Ruby 1.9 or higher
|
||||
* multi_xml
|
||||
* You like to party!
|
||||
|
||||
## Examples
|
||||
|
|
|
@ -12,7 +12,6 @@ Gem::Specification.new do |s|
|
|||
s.summary = %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 'multi_json', "~> 1.0"
|
||||
s.add_dependency 'multi_xml', ">= 0.5.2"
|
||||
|
||||
s.post_install_message = "When you HTTParty, you must party hard!"
|
||||
|
|
|
@ -4,7 +4,7 @@ require 'net/https'
|
|||
require 'uri'
|
||||
require 'zlib'
|
||||
require 'multi_xml'
|
||||
require 'multi_json'
|
||||
require 'json'
|
||||
|
||||
require 'httparty/module_inheritable_attributes'
|
||||
require 'httparty/cookie_hash'
|
||||
|
|
|
@ -110,12 +110,7 @@ module HTTParty
|
|||
end
|
||||
|
||||
def json
|
||||
# https://github.com/sferik/rails/commit/5e62670131dfa1718eaf21ff8dd3371395a5f1cc
|
||||
if MultiJson.respond_to?(:adapter)
|
||||
MultiJson.load(body)
|
||||
else
|
||||
MultiJson.decode(body)
|
||||
end
|
||||
JSON.load(body, nil)
|
||||
end
|
||||
|
||||
def html
|
||||
|
|
|
@ -144,14 +144,8 @@ describe HTTParty::Parser do
|
|||
subject.send(:xml)
|
||||
end
|
||||
|
||||
it "parses json with MultiJson" do
|
||||
MultiJson.should_receive(:load).with('body')
|
||||
subject.send(:json)
|
||||
end
|
||||
|
||||
it "uses MultiJson.decode if MultiJson does not respond to adapter" do
|
||||
MultiJson.should_receive(:respond_to?).with(:adapter).and_return(false)
|
||||
MultiJson.should_receive(:decode).with('body')
|
||||
it "parses json with JSON" do
|
||||
JSON.should_receive(:load).with('body', nil)
|
||||
subject.send(:json)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue