diff options
Diffstat (limited to 'test/spec_rack_utils.rb')
-rw-r--r-- | test/spec_rack_utils.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/spec_rack_utils.rb b/test/spec_rack_utils.rb index 96fb58a0..0a73d18c 100644 --- a/test/spec_rack_utils.rb +++ b/test/spec_rack_utils.rb @@ -462,6 +462,18 @@ context "Rack::Utils::Multipart" do params["people"][0]["files"][:filename].should.equal "file1.txt" params["people"][0]["files"][:tempfile].read.should.equal "contents" end + + specify "can parse fields that end at the end of the buffer" do + input = File.read(multipart_file("bad_robots")) + + req = Rack::Request.new Rack::MockRequest.env_for("/", + "CONTENT_TYPE" => "multipart/form-data, boundary=1yy3laWhgX31qpiHinh67wJXqKalukEUTvqTzmon", + "CONTENT_LENGTH" => input.size, + :input => input) + + req.POST['file.path'].should.equal "/var/tmp/uploads/4/0001728414" + req.POST['addresses'].should.not.equal nil + end specify "builds complete params with the chunk size of 16384 slicing exactly on boundary" do data = File.open(multipart_file("fail_16384_nofile")) { |f| f.read }.gsub(/\n/, "\r\n") |