Skip to content

Commit

Permalink
Finalize spec to solve httprb/http#663
Browse files Browse the repository at this point in the history
  • Loading branch information
ixti committed May 27, 2021
1 parent 11bb446 commit 77f70d7
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions spec/lib/http/form_data/multipart_spec.rb
Expand Up @@ -93,21 +93,28 @@ def disposition(params)
let(:params) do
[
["metadata", %(filename=first.txt)],
["file", HTTP::FormData::File.new(StringIO.new("uno"), :content_type => 'plain/text', :filename => "stream-123")],
["file", HTTP::FormData::File.new(StringIO.new("uno"), :content_type => "plain/text", :filename => "abc")],
["metadata", %(filename=second.txt)],
["file", HTTP::FormData::File.new(StringIO.new("dos"), :content_type => 'plain/text', :filename => "stream-456")]
["file", HTTP::FormData::File.new(StringIO.new("dos"), :content_type => "plain/text", :filename => "xyz")]
]
end

it "allows duplicate param names and preservesd given order" do
# form_data.boundary

expect(form_data.to_s).to eq([
%(--#{form_data.boundary}#{crlf}),
%(Content-Disposition: form-data; name="metadata"#{crlf}),
%(#{crlf}filename=first.txt#{crlf}),
%(--#{form_data.boundary}#{crlf}),
%(Content-Disposition: form-data; name="file"; filename="abc"#{crlf}),
%(Content-Type: plain/text#{crlf}),
%(#{crlf}uno#{crlf}),
%(Content-Disposition: form-data; name="metadata"#{crlf}#{crlf}),
%(filename=first.txt#{crlf}),
%(filename=second.txt#{crlf}),
%(--#{form_data.boundary}#{crlf}),
%(--#{boundary_value}--#{crlf})
%(Content-Disposition: form-data; name="file"; filename="xyz"#{crlf}),
%(Content-Type: plain/text#{crlf}),
%(#{crlf}dos#{crlf}),
%(--#{form_data.boundary}--#{crlf})
].join)
end
end
Expand Down

0 comments on commit 77f70d7

Please sign in to comment.