fetch.default

This commit is contained in:
Tom Hu
2022-04-04 17:10:55 -04:00
parent 351baf62fa
commit d4729eeb39
7 changed files with 1626 additions and 1257 deletions

View File

@@ -4,7 +4,7 @@ import * as path from 'path';
import * as core from '@actions/core';
import * as openpgp from 'openpgp';
import fetch from 'node-fetch';
import * as fetch from 'node-fetch';
import {
getBaseUrl,
@@ -24,12 +24,12 @@ const verify = async (filename: string, platform: string, version: string) => {
// Get SHASUM and SHASUM signature files
console.log(`${getBaseUrl(platform, version)}.SHA256SUM`);
const shasumRes = await fetch(
const shasumRes = await fetch.default(
`${getBaseUrl(platform, version)}.SHA256SUM`,
);
const shasum = await shasumRes.text();
const shaSigRes = await fetch(
const shaSigRes = await fetch.default(
`${getBaseUrl(platform, version)}.SHA256SUM.sig`,
);
const shaSig = await shaSigRes.text();

View File

@@ -1,5 +1,5 @@
import * as core from '@actions/core';
import fetch from 'node-fetch';
import * as fetch from 'node-fetch';
const versionInfo = async (platform: string, version?: string) => {
if (version) {
@@ -7,7 +7,7 @@ const versionInfo = async (platform: string, version?: string) => {
}
try {
const metadataRes = await fetch( `https://uploader.codecov.io/${platform}/latest`, {
const metadataRes = await fetch.default( `https://uploader.codecov.io/${platform}/latest`, {
headers: {'Accept': 'application/json'},
});
const metadata = await metadataRes.json();