File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
lib/services/service_brokers/v2
spec/unit/lib/services/service_brokers/v2 Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ def initialize(attrs, logger=nil)
1717 @auth_password = attrs . fetch ( :auth_password )
1818 @verify_mode = verify_certs? ? OpenSSL ::SSL ::VERIFY_PEER : OpenSSL ::SSL ::VERIFY_NONE
1919 @broker_client_timeout = VCAP ::CloudController ::Config . config . get ( :broker_client_timeout_seconds )
20- @header_api_info_location = "#{ VCAP ::CloudController ::Config . config . get ( :external_domain ) } /v2/info"
20+ api_info_path = VCAP ::CloudController ::Config . config . get ( :temporary_enable_v2 ) ? '/v2/info' : '/'
21+ @header_api_info_location = "#{ VCAP ::CloudController ::Config . config . get ( :external_domain ) } #{ api_info_path } "
2122 @logger = logger || Steno . logger ( 'cc.service_broker.v2.http_client' )
2223 end
2324
Original file line number Diff line number Diff line change @@ -66,12 +66,12 @@ module VCAP::Services::ServiceBrokers::V2
6666 to have_been_made
6767 end
6868
69- it 'sets the X-Api-Info-Location header to the /v2/info endpoint at the external address' do
69+ it 'sets the X-Api-Info-Location header to the correct endpoint at the external address' do
7070 make_request
7171 expect ( a_request ( http_method , full_url ) .
7272 with ( basic_auth :) .
7373 with ( query : hash_including ( { } ) ) .
74- with ( headers : { 'X-Api-Info-Location' => "#{ TestConfig . config [ :external_domain ] } /v2/info" } ) ) .
74+ with ( headers : { 'X-Api-Info-Location' => "#{ TestConfig . config [ :external_domain ] } #{ TestConfig . config [ :temporary_enable_v2 ] ? ' /v2/info' : '/' } " } ) ) .
7575 to have_been_made
7676 end
7777
@@ -86,7 +86,8 @@ module VCAP::Services::ServiceBrokers::V2
8686 expect ( fake_logger ) . to have_received ( :debug ) . with ( match ( /X-VCAP-Request-ID"=>"[[:alnum:]-]+/ ) )
8787 expect ( fake_logger ) . to have_received ( :debug ) . with ( match ( /X-Broker-API-Request-Identity"=>"[[:alnum:]-]+/ ) )
8888 expect ( fake_logger ) . to have_received ( :debug ) . with ( match ( /X-Broker-Api-Version"=>"2\. 15/ ) )
89- expect ( fake_logger ) . to have_received ( :debug ) . with ( match ( %r{X-Api-Info-Location"=>"api2\. vcap\. me/v2/info} ) )
89+ api_info_path = TestConfig . config [ :temporary_enable_v2 ] ? '/v2/info' : '/'
90+ expect ( fake_logger ) . to have_received ( :debug ) . with ( match ( /X-Api-Info-Location"=>"api2\. vcap\. me#{ api_info_path } / ) )
9091 end
9192
9293 context 'when an https URL is used' do
You can’t perform that action at this time.
0 commit comments