diff --git a/sources/package.json b/sources/package.json index e9659080..a059f90d 100644 --- a/sources/package.json +++ b/sources/package.json @@ -44,6 +44,7 @@ "cheerio": "1.1.0", "semver": "7.7.2", "string-argv": "0.3.2", + "typed-rest-client": "2.1.0", "unhomoglyph": "1.0.6", "which": "5.0.0" }, diff --git a/sources/src/wrapper-validation/checksums.ts b/sources/src/wrapper-validation/checksums.ts index 921da414..bcc80b24 100644 --- a/sources/src/wrapper-validation/checksums.ts +++ b/sources/src/wrapper-validation/checksums.ts @@ -1,6 +1,7 @@ +import * as httpm from 'typed-rest-client/HttpClient' import * as cheerio from 'cheerio' import * as core from '@actions/core' -import * as httpm from '@actions/http-client' +//import * as httpm from '@actions/http-client' import fileWrapperChecksums from './wrapper-checksums.json' @@ -69,20 +70,23 @@ async function httpGetJsonArray(url: string): Promise { } async function httpGetText(url: string): Promise { - const maxAttempts = 4 - let attempts = 0 - while (attempts < maxAttempts) { - try { - const response = await httpc.get(url) - return await response.readBody() - } catch (error) { - attempts++ - if (attempts === maxAttempts) { - return new Promise((_resolve, reject) => reject(error)) - } - } - } - return new Promise((_resolve, reject) => reject(new Error('Illegal state'))) + const response = await httpc.get(url) + return await response.readBody() + + // const maxAttempts = 4 + // let attempts = 0 + // while (attempts < maxAttempts) { + // try { + // const response = await httpc.get(url) + // return await response.readBody() + // } catch (error) { + // attempts++ + // if (attempts === maxAttempts) { + // return new Promise((_resolve, reject) => reject(error)) + // } + // } + // } + // return new Promise((_resolve, reject) => reject(new Error('Illegal state'))) } async function addDistributionSnapshotChecksumUrls(checksumUrls: [string, string][]): Promise {