-
-
Save jdelStrother/28075f66b2a490431083 to your computer and use it in GitHub Desktop.
Failing test for rack's multipart handling with content types on multipart params
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/test/spec_utils.rb b/test/spec_utils.rb | |
index 822058b..636794d 100644 | |
--- a/test/spec_utils.rb | |
+++ b/test/spec_utils.rb | |
@@ -614,4 +614,24 @@ describe Rack::Utils::Multipart do | |
should.raise(ArgumentError). | |
message.should.equal "value must be a Hash" | |
end | |
+ | |
+ it "can parse fields with a content type" do | |
+ data = <<-EOF | |
+--1yy3laWhgX31qpiHinh67wJXqKalukEUTvqTzmon\r | |
+Content-Disposition: form-data; name="description"\r | |
+Content-Type: text/plain"\r | |
+\r | |
+Very very blue\r | |
+--1yy3laWhgX31qpiHinh67wJXqKalukEUTvqTzmon--\r | |
+EOF | |
+ options = { | |
+ "CONTENT_TYPE" => "multipart/form-data; boundary=1yy3laWhgX31qpiHinh67wJXqKalukEUTvqTzmon", | |
+ "CONTENT_LENGTH" => data.length.to_s, | |
+ :input => StringIO.new(data) | |
+ } | |
+ env = Rack::MockRequest.env_for("/", options) | |
+ params = Rack::Utils::Multipart.parse_multipart(env) | |
+ | |
+ params.should.equal({"description"=>"Very very blue"}) | |
+ end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment