|
140 | 140 | end.to raise_error(Google::Apis::UniverseDomainError) |
141 | 141 | end |
142 | 142 |
|
| 143 | + it 'should not include Accept-Encoding header' do |
| 144 | + expect(command.options.header&.[]('Accept-Encoding')).to be_nil |
| 145 | + end |
| 146 | + |
143 | 147 | include_examples 'with options' |
144 | 148 | end |
145 | 149 |
|
|
173 | 177 | expect(command.query).to include('alt' => 'media') |
174 | 178 | end |
175 | 179 |
|
| 180 | + it 'should not include Accept-Encoding header' do |
| 181 | + expect(command.options.header&.[]('Accept-Encoding')).to be_nil |
| 182 | + end |
| 183 | + |
176 | 184 | include_examples 'with options' |
177 | 185 | end |
178 | 186 |
|
|
192 | 200 | expect(command.query).to include('alt' => 'media') |
193 | 201 | end |
194 | 202 |
|
| 203 | + it 'should include Accept-Encoding header' do |
| 204 | + expect(command.options.header['Accept-Encoding']).to eq('gzip') |
| 205 | + end |
| 206 | + |
| 207 | + ['ACCEPT-ENCODING', 'Accept-Encoding', 'accept-encoding', :'ACCEPT-ENCODING', :'Accept-Encoding', :'accept-encoding'].each do |header_key| |
| 208 | + it "should respect alternative capitalization/type of Accept-Encoding for #{header_key}" do |
| 209 | + cmd = service.send(:make_storage_download_command, :get, 'zoo/animals', header: { header_key => 'identity' }) |
| 210 | + expect(cmd.options.header[header_key]).to eq('identity') |
| 211 | + expect(cmd.options.header.keys.count { |k| k.to_s.casecmp('accept-encoding') == 0 }).to eq(1) |
| 212 | + end |
| 213 | + end |
| 214 | + |
195 | 215 | include_examples 'with options' |
196 | 216 | end |
197 | 217 |
|
|
207 | 227 | expect(url).to eql 'https://www.googleapis.com/upload/zoo/animals' |
208 | 228 | end |
209 | 229 |
|
| 230 | + it 'should not include Accept-Encoding header' do |
| 231 | + expect(command.options.header&.[]('Accept-Encoding')).to be_nil |
| 232 | + end |
| 233 | + |
210 | 234 | include_examples 'with options' |
211 | 235 | end |
212 | 236 |
|
|
222 | 246 | expect(url).to eql 'https://www.googleapis.com/upload/zoo/animals' |
223 | 247 | end |
224 | 248 |
|
| 249 | + it 'should include Accept-Encoding header' do |
| 250 | + expect(command.options.header['Accept-Encoding']).to eq('gzip') |
| 251 | + end |
| 252 | + |
| 253 | + ['ACCEPT-ENCODING', 'Accept-Encoding', 'accept-encoding', :'ACCEPT-ENCODING', :'Accept-Encoding', :'accept-encoding'].each do |header_key| |
| 254 | + it "should respect alternative capitalization/type of Accept-Encoding for #{header_key}" do |
| 255 | + cmd = service.send(:make_storage_upload_command, :post, 'zoo/animals', header: { header_key => 'identity' }) |
| 256 | + expect(cmd.options.header[header_key]).to eq('identity') |
| 257 | + expect(cmd.options.header.keys.count { |k| k.to_s.casecmp('accept-encoding') == 0 }).to eq(1) |
| 258 | + end |
| 259 | + end |
| 260 | + |
225 | 261 | include_examples 'with options' |
226 | 262 | end |
227 | 263 |
|
|
263 | 299 | command |
264 | 300 | expect(a_request(:put, upload_url)).to have_been_made.twice |
265 | 301 | end |
| 302 | + |
| 303 | + it 'should include an accept-encoding header' do |
| 304 | + command |
| 305 | + expect(a_request(:put, upload_url).with { |req| req.headers['Accept-Encoding'] == 'gzip' }).to have_been_made.twice |
| 306 | + end |
| 307 | + |
266 | 308 | end |
267 | 309 | context 'not restart resumable upload if upload is completed' do |
268 | 310 | before(:example) do |
|
286 | 328 | command |
287 | 329 | expect(a_request(:put, upload_url)).to have_been_made |
288 | 330 | end |
| 331 | + |
| 332 | + it 'should include an accept-encoding header' do |
| 333 | + command |
| 334 | + expect(a_request(:put, upload_url).with { |req| req.headers['Accept-Encoding'] == 'gzip' }).to have_been_made |
| 335 | + end |
289 | 336 | end |
290 | 337 | end |
291 | 338 |
|
|
0 commit comments