File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -341,7 +341,7 @@ def handle_redirection(&block)
341
341
def handle_host_redirection
342
342
check_duplicate_location_header
343
343
redirect_path = options [ :uri_adapter ] . parse ( last_response [ 'location' ] ) . normalize
344
- return if redirect_path . relative? || path . host == redirect_path . host
344
+ return if redirect_path . relative? || path . host == redirect_path . host || uri . host == redirect_path . host
345
345
@changed_hosts = true
346
346
end
347
347
Original file line number Diff line number Diff line change 1369
1369
@request . send ( :setup_raw_request )
1370
1370
expect ( @request . instance_variable_get ( :@raw_request ) [ 'authorization' ] ) . to eq ( @authorization )
1371
1371
end
1372
+
1373
+ context 'when uri path is a relative path' do
1374
+ before do
1375
+ @request . path = '/v1'
1376
+ @request . options [ :base_uri ] = 'http://api.foo.com'
1377
+ end
1378
+
1379
+ it "should send Authorization header when redirecting to the same host" do
1380
+ @redirect [ 'location' ] = 'http://api.foo.com/v2'
1381
+ @request . perform
1382
+ @request . send ( :setup_raw_request )
1383
+ expect ( @request . instance_variable_get ( :@raw_request ) [ 'authorization' ] ) . to eq ( @authorization )
1384
+ end
1385
+ end
1372
1386
end
1373
1387
end
1374
1388
You can’t perform that action at this time.
0 commit comments