Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…(JSON or Yajl or whatever).
  • Loading branch information...
commit 1be6534cde8d7990fca9787e3ab288ae90bce7d8 1 parent acdcb25
@seamusabshere authored
Showing with 2 additions and 6 deletions.
  1. +2 −6 lib/rack/contrib/post_body_content_type_parser.rb
View
8 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
Please sign in to comment.
Something went wrong with that request. Please try again.