refactor: remove redundant API call (#175)

Combines the two installation requests (org and user) into one because
`/org/{org}` can also be accessed at `/users/{org}`.

---------

Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
This commit is contained in:
Parker Brown
2024-10-07 13:26:35 -07:00
committed by GitHub
co-authored by Gregor Martynus
parent a2c2dfabb4
commit 25cc3bdc27
8 changed files with 278 additions and 197 deletions
+20 -7
View File
@@ -560,10 +560,10 @@ var require_proxy = __commonJS({
})();
if (proxyVar) {
try {
return new URL(proxyVar);
return new DecodedURL(proxyVar);
} catch (_a) {
if (!proxyVar.startsWith("http://") && !proxyVar.startsWith("https://"))
return new URL(`http://${proxyVar}`);
return new DecodedURL(`http://${proxyVar}`);
}
} else {
return void 0;
@@ -606,6 +606,19 @@ var require_proxy = __commonJS({
const hostLower = host.toLowerCase();
return hostLower === "localhost" || hostLower.startsWith("127.") || hostLower.startsWith("[::1]") || hostLower.startsWith("[0:0:0:0:0:0:0:1]");
}
var DecodedURL = class extends URL {
constructor(url, base) {
super(url, base);
this._decodedUsername = decodeURIComponent(super.username);
this._decodedPassword = decodeURIComponent(super.password);
}
get username() {
return this._decodedUsername;
}
get password() {
return this._decodedPassword;
}
};
}
});
@@ -18140,7 +18153,7 @@ var require_lib = __commonJS({
}
const usingSsl = parsedUrl.protocol === "https:";
proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl2.href, pipelining: !this._keepAlive ? 0 : 1 }, (proxyUrl2.username || proxyUrl2.password) && {
token: `${proxyUrl2.username}:${proxyUrl2.password}`
token: `Basic ${Buffer.from(`${proxyUrl2.username}:${proxyUrl2.password}`).toString("base64")}`
}));
this._proxyAgentDispatcher = proxyAgent;
if (usingSsl && this._ignoreSslError) {
@@ -36791,11 +36804,11 @@ var RequestError = class extends Error {
response;
constructor(message, statusCode, options) {
super(message);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
this.name = "HttpError";
this.status = statusCode;
this.status = Number.parseInt(statusCode);
if (Number.isNaN(this.status)) {
this.status = 0;
}
if ("response" in options) {
this.response = options.response;
}