Permalink
Browse files

Replace yajl with multi_json in JSONResponse middleware

  • Loading branch information...
1 parent bc86cc2 commit ffad44427696abff163f1b8d7944cdd695975a89 @sferik sferik committed Jun 30, 2013
Showing with 6 additions and 6 deletions.
  1. +1 −1 em-http-request.gemspec
  2. +2 −2 lib/em-http/middleware/json_response.rb
  3. +1 −1 spec/helper.rb
  4. +2 −2 spec/middleware_spec.rb
@@ -21,10 +21,10 @@ Gem::Specification.new do |s|
s.add_dependency 'http_parser.rb', '>= 0.6.0.beta.2'
s.add_development_dependency 'mongrel', '~> 1.2.0.pre2'
+ s.add_development_dependency 'multi_json'
s.add_development_dependency 'rack'
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec'
- s.add_development_dependency 'yajl-ruby'
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,11 +1,11 @@
-require 'yajl'
+require 'multi_json'
module EventMachine
module Middleware
class JSONResponse
def response(resp)
begin
- body = Yajl::Parser.parse(resp.response)
+ body = MultiJson.load(resp.response)
resp.response = body
rescue Exception => e
end
View
@@ -3,7 +3,7 @@
require 'em-http'
require 'em-http/middleware/oauth2'
-require 'yajl'
+require 'multi_json'
require 'stallion'
require 'stub_server'
@@ -117,11 +117,11 @@ def request(client, head, body)
context "jsonify" do
class JSONify
def request(client, head, body)
- [head, Yajl::Encoder.encode(body)]
+ [head, MultiJson.dump(body)]
end
def response(resp)
- resp.response = Yajl::Parser.parse(resp.response)
+ resp.response = MultiJson.load(resp.response)
end
end

0 comments on commit ffad444

Please sign in to comment.