summary refs log tree commit
path: root/test/spec_request.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafael.franca@plataformatec.com.br>2014-07-18 17:56:51 -0300
committerRafael Mendonça França <rafael.franca@plataformatec.com.br>2014-07-18 18:10:30 -0300
commit28ba782f06d97085862f72227815d492fcfc83c9 (patch)
tree3abe334d2b4629dd6fd0a4742695b59b7d775d0e /test/spec_request.rb
parent2683d278913529400d13fd32b2a85e9eaa7f272c (diff)
downloadrack-28ba782f06d97085862f72227815d492fcfc83c9.tar.gz
Fix media_type_params when Content-Type parameters contains quoted-strings
According RFC 2616, the Content-Type parameters value can be even a token or
a quoted-string:

    media-type     = type "/" subtype *( ";" parameter )
    type           = token
    subtype        = token
    parameter      = attribute "=" value
    attribute      = token
    value          = token | quoted-string
    quoted-string  = ( <"> *(qdtext | quoted-pair ) <"> )
    qdtext         = <any TEXT except <">>"
    quoted-pair    = "\" CHAR
Diffstat (limited to 'test/spec_request.rb')
-rw-r--r--test/spec_request.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/spec_request.rb b/test/spec_request.rb
index e5ec254e..09a308a6 100644
--- a/test/spec_request.rb
+++ b/test/spec_request.rb
@@ -611,7 +611,7 @@ describe Rack::Request do
   should "handle multiple media type parameters" do
     req = Rack::Request.new \
       Rack::MockRequest.env_for("/",
-        "CONTENT_TYPE" => 'text/plain; foo=BAR,baz=bizzle dizzle;BLING=bam')
+        "CONTENT_TYPE" => 'text/plain; foo=BAR,baz=bizzle dizzle;BLING=bam;blong="boo";zump="zoo\"o"')
       req.should.not.be.form_data
       req.media_type_params.should.include 'foo'
       req.media_type_params['foo'].should.equal 'BAR'
@@ -620,6 +620,8 @@ describe Rack::Request do
       req.media_type_params.should.not.include 'BLING'
       req.media_type_params.should.include 'bling'
       req.media_type_params['bling'].should.equal 'bam'
+      req.media_type_params['blong'].should.equal 'boo'
+      req.media_type_params['zump'].should.equal 'zoo\"o'
   end
 
   should "parse with junk before boundry" do