summary refs log tree commit
path: root/test/spec_request.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/spec_request.rb')
-rw-r--r--test/spec_request.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/spec_request.rb b/test/spec_request.rb
index 8a2b4760..c4a7400a 100644
--- a/test/spec_request.rb
+++ b/test/spec_request.rb
@@ -267,6 +267,16 @@ describe Rack::Request do
     input.read.should.equal "foo=bar&quux=bla"
   end
 
+  should "accept application/json content type" do
+    input = StringIO.new('{"foo":"bar","quxx":"bla"}')
+    req = Rack::Request.new \
+      Rack::MockRequest.env_for("/",
+        "CONTENT_TYPE" => 'application/json',
+        :input => input)
+    req.params.should.equal "foo" => "bar", "quxx" => "bla"
+    input.read.should.equal '{"foo":"bar","quxx":"bla"}'
+  end
+
   should "clean up Safari's ajax POST body" do
     req = Rack::Request.new \
       Rack::MockRequest.env_for("/",