diff --git a/dist/index.js b/dist/index.js index 6a669a0..d042a98 100644 --- a/dist/index.js +++ b/dist/index.js @@ -33164,17 +33164,13 @@ function uploadSpecAndConfig(specPath, configPath, token) { return __awaiter(this, void 0, void 0, function* () { const formData = new form_data_1.default(); // append a spec file - const specStats = fs_1.default.statSync(specPath); formData.append('oasSpec', fs_1.default.createReadStream(specPath), { contentType: 'text/plain', - knownLength: specStats.size, }); // append a config file, if present if (configPath) { - const configStats = fs_1.default.statSync(configPath); formData.append('stainlessConfig', fs_1.default.createReadStream(configPath), { contentType: 'text/plain', - knownLength: configStats.size, }); } const response = yield (0, node_fetch_1.default)('https://api.stainlessapi.com/api/spec', { diff --git a/index.ts b/index.ts index b088c69..c31fe80 100644 --- a/index.ts +++ b/index.ts @@ -2,7 +2,7 @@ import fs from 'fs'; import { getInput } from '@actions/core'; import { error, info } from 'console'; import { writeFile } from 'fs-extra'; -import fetch from 'node-fetch'; +import fetch, { Response } from 'node-fetch'; import FormData from 'form-data'; export async function main() { @@ -28,22 +28,18 @@ export async function main() { } } -async function uploadSpecAndConfig(specPath: string, configPath: string, token: string) { +async function uploadSpecAndConfig(specPath: string, configPath: string, token: string): Promise { const formData = new FormData(); // append a spec file - const specStats = fs.statSync(specPath); formData.append('oasSpec', fs.createReadStream(specPath), { contentType: 'text/plain', - knownLength: specStats.size, }); // append a config file, if present if (configPath) { - const configStats = fs.statSync(configPath); formData.append('stainlessConfig', fs.createReadStream(configPath), { contentType: 'text/plain', - knownLength: configStats.size, }); }