From ba1cd59001665e1e201dcb7096c92be8ba61e188 Mon Sep 17 00:00:00 2001 From: Rob Herley Date: Wed, 6 Dec 2023 18:31:29 -0500 Subject: [PATCH] pls work --- dist/index.js | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/dist/index.js b/dist/index.js index 2cb5319..fa7016a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5610,7 +5610,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.internalArtifactTwirpClient = void 0; -const index_1 = __nccwpck_require__(76308); +const http_client_1 = __nccwpck_require__(76308); const auth_1 = __nccwpck_require__(74548); const core_1 = __nccwpck_require__(66526); const generated_1 = __nccwpck_require__(90265); @@ -5632,7 +5632,7 @@ class ArtifactHttpClient { if (retryMultiplier) { this.retryMultiplier = retryMultiplier; } - this.httpClient = new index_1.HttpClient(userAgent, [ + this.httpClient = new http_client_1.HttpClient(userAgent, [ new auth_1.BearerCredentialHandler(token) ]); } @@ -5646,13 +5646,7 @@ class ArtifactHttpClient { 'Content-Type': contentType }; try { - // const response = await this.retryableRequest(async () => - const response = yield this.httpClient.post(url, JSON.stringify(data), headers); - if (response.message.statusCode !== 200) { - throw new Error(`Non-200: ${response.message.statusCode}`); - } - const body = yield response.readBody(); - (0, core_1.debug)(`[Response] ${body}`); + const { body } = yield this.retryableRequest(() => __awaiter(this, void 0, void 0, function* () { return this.httpClient.post(url, JSON.stringify(data), headers); })); return JSON.parse(body); } catch (error) { @@ -5668,11 +5662,12 @@ class ArtifactHttpClient { let isRetryable = false; try { const response = yield operation(); + const body = yield response.readBody(); const statusCode = response.message.statusCode; (0, core_1.debug)(`[Response] ${response.message.statusCode}`); (0, core_1.debug)(JSON.stringify(response.message.headers, null, 2)); if (this.isSuccessStatusCode(statusCode)) { - return response; + return { response, body }; } isRetryable = this.isRetryableHttpStatusCode(statusCode); errorMessage = `Failed request: (${statusCode}) ${response.message.statusMessage}`; @@ -5704,11 +5699,11 @@ class ArtifactHttpClient { if (!statusCode) return false; const retryableStatusCodes = [ - index_1.HttpCodes.BadGateway, - index_1.HttpCodes.GatewayTimeout, - index_1.HttpCodes.InternalServerError, - index_1.HttpCodes.ServiceUnavailable, - index_1.HttpCodes.TooManyRequests, + http_client_1.HttpCodes.BadGateway, + http_client_1.HttpCodes.GatewayTimeout, + http_client_1.HttpCodes.InternalServerError, + http_client_1.HttpCodes.ServiceUnavailable, + http_client_1.HttpCodes.TooManyRequests, 413 // Payload Too Large ]; return retryableStatusCodes.includes(statusCode);