Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replace yajl with multi_json in JSONResponse middleware

  • Loading branch information...
commit ffad44427696abff163f1b8d7944cdd695975a89 1 parent bc86cc2
@sferik sferik authored
View
2  em-http-request.gemspec
@@ -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")
View
4 lib/em-http/middleware/json_response.rb
@@ -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
2  spec/helper.rb
@@ -3,7 +3,7 @@
require 'em-http'
require 'em-http/middleware/oauth2'
-require 'yajl'
+require 'multi_json'
require 'stallion'
require 'stub_server'
View
4 spec/middleware_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.