|
1 | 1 | /** |
2 | 2 | * Copyright 2018 Google LLC |
3 | 3 | * |
4 | | - * Distributed under MIT license. |
5 | | - * See file LICENSE for detail or copy at https://opensource.org/licenses/MIT |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
6 | 15 | */ |
7 | 16 |
|
8 | 17 | import {GaxiosError, GaxiosOptions, GaxiosResponse, request} from 'gaxios'; |
@@ -173,7 +182,9 @@ async function fastFailMetadataRequest<T>( |
173 | 182 | ): Promise<GaxiosResponse> { |
174 | 183 | const secondaryOptions = { |
175 | 184 | ...options, |
176 | | - url: options.url!.replace(getBaseUrl(), getBaseUrl(SECONDARY_HOST_ADDRESS)), |
| 185 | + url: options.url |
| 186 | + ?.toString() |
| 187 | + .replace(getBaseUrl(), getBaseUrl(SECONDARY_HOST_ADDRESS)), |
177 | 188 | }; |
178 | 189 | // We race a connection between DNS/IP to metadata server. There are a couple |
179 | 190 | // reasons for this: |
|
0 commit comments