File tree 2 files changed +25
-1
lines changed 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -715,7 +715,7 @@ export class Storage extends Service {
715
715
customEndpoint = true ;
716
716
}
717
717
718
- if ( options . apiEndpoint ) {
718
+ if ( options . apiEndpoint && options . apiEndpoint !== apiEndpoint ) {
719
719
apiEndpoint = Storage . sanitizeEndpoint ( options . apiEndpoint ) ;
720
720
customEndpoint = true ;
721
721
}
Original file line number Diff line number Diff line change @@ -174,6 +174,30 @@ describe('Storage', () => {
174
174
assert . strictEqual ( calledWith . apiEndpoint , `${ apiEndpoint } ` ) ;
175
175
} ) ;
176
176
177
+ it ( 'should not set `customEndpoint` if `apiEndpoint` matches default' , ( ) => {
178
+ const apiEndpoint = 'https://storage.googleapis.com' ;
179
+ const storage = new Storage ( {
180
+ apiEndpoint,
181
+ } ) ;
182
+
183
+ const calledWith = storage . calledWith_ [ 0 ] ;
184
+ assert . strictEqual ( calledWith . apiEndpoint , apiEndpoint ) ;
185
+ assert . strictEqual ( calledWith . customEndpoint , false ) ;
186
+ } ) ;
187
+
188
+ it ( 'should not set `customEndpoint` if `apiEndpoint` matches default (w/ universe domain)' , ( ) => {
189
+ const universeDomain = 'my.universe' ;
190
+ const apiEndpoint = `https://storage.${ universeDomain } ` ;
191
+ const storage = new Storage ( {
192
+ apiEndpoint,
193
+ universeDomain,
194
+ } ) ;
195
+
196
+ const calledWith = storage . calledWith_ [ 0 ] ;
197
+ assert . strictEqual ( calledWith . apiEndpoint , apiEndpoint ) ;
198
+ assert . strictEqual ( calledWith . customEndpoint , false ) ;
199
+ } ) ;
200
+
177
201
it ( 'should propagate the useAuthWithCustomEndpoint option' , ( ) => {
178
202
const useAuthWithCustomEndpoint = true ;
179
203
const apiEndpoint = 'https://some.fake.endpoint' ;
You can’t perform that action at this time.
0 commit comments