Skip to content

Commit 648c49e

Browse files
committed
rack: add test for Content-ID handling
1 parent e6d8d11 commit 648c49e

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

rack/test/multipart/content_id

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--AaB03x
2+
Content-Disposition: form-data
3+
Content-ID: name-via-content-id
4+
5+
Larry
6+
--AaB03x
7+
Content-Disposition: form-data; name="name-via-disposition"
8+
Content-Type: text/plain
9+
10+
Berry
11+
--AaB03x--

rack/test/spec_multipart.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@ def rd.length
174174
params.keys.should.not.include "files"
175175
end
176176

177+
should "use Content-ID header for the name, if no name is given" do
178+
env = Rack::MockRequest.env_for("/", multipart_fixture(:content_id))
179+
params = Rack::Multipart.parse_multipart(env)
180+
params["name-via-content-id"].should.equal "Larry"
181+
params["name-via-disposition"].should.equal "Berry"
182+
end
183+
177184
should "parse multipart/mixed" do
178185
env = Rack::MockRequest.env_for("/", multipart_fixture(:mixed_files))
179186
params = Rack::Utils::Multipart.parse_multipart(env)

0 commit comments

Comments
 (0)