File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ def normalize_query(query)
83
83
def content_body ( object )
84
84
if file? ( object )
85
85
object = ( file = object ) . read
86
+ object . force_encoding ( Encoding ::UTF_8 ) if object . respond_to? ( :force_encoding )
86
87
file . rewind if file . respond_to? ( :rewind )
87
88
end
88
89
Original file line number Diff line number Diff line change 137
137
it { is_expected . to eq multipart_params }
138
138
139
139
end
140
+
141
+ context 'when file is binary data and params contain non-ascii characters' do
142
+ let ( :file ) { File . open ( 'spec/fixtures/tiny.gif' , 'rb' ) }
143
+ let ( :params ) do
144
+ {
145
+ user : "Jöhn Döé" ,
146
+ enabled : true ,
147
+ avatar : file ,
148
+ }
149
+ end
150
+
151
+ it { expect { subject } . not_to raise_error }
152
+ end
140
153
end
141
154
end
142
155
end
You can’t perform that action at this time.
0 commit comments