@@ -66,12 +66,12 @@ module VCAP::Services::ServiceBrokers::V2
66
66
to have_been_made
67
67
end
68
68
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
70
70
make_request
71
71
expect ( a_request ( http_method , full_url ) .
72
72
with ( basic_auth :) .
73
73
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' : '/' } " } ) ) .
75
75
to have_been_made
76
76
end
77
77
@@ -86,7 +86,8 @@ module VCAP::Services::ServiceBrokers::V2
86
86
expect ( fake_logger ) . to have_received ( :debug ) . with ( match ( /X-VCAP-Request-ID"=>"[[:alnum:]-]+/ ) )
87
87
expect ( fake_logger ) . to have_received ( :debug ) . with ( match ( /X-Broker-API-Request-Identity"=>"[[:alnum:]-]+/ ) )
88
88
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 } / ) )
90
91
end
91
92
92
93
context 'when an https URL is used' do
@@ -148,6 +149,40 @@ module VCAP::Services::ServiceBrokers::V2
148
149
end
149
150
end
150
151
152
+ context 'X-Api-Info-Location' do
153
+ context 'when temporary_enable_v2 is true' do
154
+ before do
155
+ TestConfig . config [ :temporary_enable_v2 ] = true
156
+ end
157
+
158
+ it 'sets the info location to /v2/info' do
159
+ make_request
160
+
161
+ expect ( a_request ( http_method , full_url ) .
162
+ with ( basic_auth :) .
163
+ with ( query : hash_including ( { } ) ) .
164
+ with ( headers : { 'X-Api-Info-Location' => 'api2.vcap.me/v2/info' } ) ) .
165
+ to have_been_made
166
+ end
167
+ end
168
+
169
+ context 'when temporary_enable_v2 is false' do
170
+ before do
171
+ TestConfig . config [ :temporary_enable_v2 ] = false
172
+ end
173
+
174
+ it 'sets the info location to /' do
175
+ make_request
176
+
177
+ expect ( a_request ( http_method , full_url ) .
178
+ with ( basic_auth :) .
179
+ with ( query : hash_including ( { } ) ) .
180
+ with ( headers : { 'X-Api-Info-Location' => 'api2.vcap.me/' } ) ) .
181
+ to have_been_made
182
+ end
183
+ end
184
+ end
185
+
151
186
context 'X-Broker-Api-Originating-Identity' do
152
187
context 'when user guid is set in the SecurityContext' do
153
188
before do
0 commit comments