Permalink
Browse files

Use MultiJson, which will pick up whatever JSON backend you're using …

…(JSON or Yajl or whatever).
  • Loading branch information...
seamusabshere committed Oct 21, 2011
1 parent acdcb25 commit 1be6534cde8d7990fca9787e3ab288ae90bce7d8
Showing with 2 additions and 6 deletions.
  1. +2 −6 lib/rack/contrib/post_body_content_type_parser.rb
@@ -1,8 +1,4 @@
-begin
- require 'json'
-rescue LoadError => e
- require 'json/pure'
-end
+require 'multi_json'
module Rack
@@ -30,7 +26,7 @@ def initialize(app)
def call(env)
if Rack::Request.new(env).media_type == APPLICATION_JSON && (body = env[POST_BODY].read).length != 0
- env.update(FORM_HASH => JSON.parse(body), FORM_INPUT => env[POST_BODY])
+ env.update(FORM_HASH => MultiJson.decode(body), FORM_INPUT => env[POST_BODY])
end
@app.call(env)
end

0 comments on commit 1be6534

Please sign in to comment.