azdo-cli 0.25.0-feature-devcontainer-caddy-proxy.939 → 0.25.0-feature-devcontainer-caddy-proxy.940
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -406,17 +406,23 @@ var DEFAULT_FIELDS = [
|
|
|
406
406
|
"System.AreaPath",
|
|
407
407
|
"System.IterationPath"
|
|
408
408
|
];
|
|
409
|
+
var ROUTED_API_HOSTS = {
|
|
410
|
+
"dev.azure.com": "",
|
|
411
|
+
// "_vssps" cannot be an organization name, so it never clashes with /<org>/.
|
|
412
|
+
"vssps.dev.azure.com": "/_vssps"
|
|
413
|
+
};
|
|
409
414
|
function routeAzureDevOpsApiUrl(url) {
|
|
410
415
|
const proxyBase = process.env.AZDO_API_BASE_URL?.trim();
|
|
411
416
|
if (!proxyBase) return url;
|
|
412
417
|
const original = new URL(url);
|
|
413
|
-
|
|
418
|
+
const hostPrefix = ROUTED_API_HOSTS[original.hostname];
|
|
419
|
+
if (hostPrefix === void 0 || !original.pathname.includes("/_apis/")) return url;
|
|
414
420
|
const base = new URL(proxyBase);
|
|
415
421
|
const basePath = base.pathname.replace(/\/$/, "");
|
|
416
422
|
original.protocol = base.protocol;
|
|
417
423
|
original.hostname = base.hostname;
|
|
418
424
|
original.port = base.port;
|
|
419
|
-
original.pathname = `${basePath}${original.pathname}`;
|
|
425
|
+
original.pathname = `${basePath}${hostPrefix}${original.pathname}`;
|
|
420
426
|
return original.toString();
|
|
421
427
|
}
|
|
422
428
|
function authHeaders(credentialOrPat) {
|