File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 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)
341341 def handle_host_redirection
342342 check_duplicate_location_header
343343 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
345345 @changed_hosts = true
346346 end
347347
Original file line number Diff line number Diff line change 13691369 @request . send ( :setup_raw_request )
13701370 expect ( @request . instance_variable_get ( :@raw_request ) [ 'authorization' ] ) . to eq ( @authorization )
13711371 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
13721386 end
13731387 end
13741388
You can’t perform that action at this time.
0 commit comments