|
1 | 1 | # Copyright, 2012, by Nick Sieger. |
2 | 2 | # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com> |
3 | | -# |
| 3 | +# |
4 | 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy |
5 | 5 | # of this software and associated documentation files (the "Software"), to deal |
6 | 6 | # in the Software without restriction, including without limitation the rights |
7 | 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
8 | 8 | # copies of the Software, and to permit persons to whom the Software is |
9 | 9 | # furnished to do so, subject to the following conditions: |
10 | | -# |
| 10 | +# |
11 | 11 | # The above copyright notice and this permission notice shall be included in |
12 | 12 | # all copies or substantial portions of the Software. |
13 | | -# |
| 13 | +# |
14 | 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
15 | 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
16 | 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
@@ -41,7 +41,7 @@ def assert_part_length(part) |
41 | 41 | def content_type; 'application/data'; end |
42 | 42 | end |
43 | 43 | end |
44 | | - |
| 44 | + |
45 | 45 | it "test_file_with_upload_io" do |
46 | 46 | expect(Parts::Part.file?(UploadIO.new(__FILE__, "text/plain"))).to be true |
47 | 47 | end |
@@ -82,6 +82,11 @@ def content_type; 'application/data'; end |
82 | 82 | assert_part_length Parts::FilePart.new("boundary", "multibyte", UploadIO.new(file, "text/plain")) |
83 | 83 | file.close |
84 | 84 | end |
| 85 | + |
| 86 | + it "test_force_content_type_header" do |
| 87 | + part = Parts::FilePart.new("boundary", "afile", UploadIO.new(TEMP_FILE, "text/plain"), { "Content-Type" => "application/pdf" }) |
| 88 | + expect(part.to_io.read).to match(/Content-Type: application\/pdf/) |
| 89 | + end |
85 | 90 | end |
86 | 91 |
|
87 | 92 | RSpec.describe Parts::ParamPart do |
|
0 commit comments