Skip to content

Commit c08ddba

Browse files
committed
removed file uploads
1 parent 1c37d14 commit c08ddba

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

index.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
const https = require('https');
22
const axios = require('axios');
3-
const FormData = require('form-data');
4-
const fs = require('fs');
53
const path = require('path');
64
const marked = require('marked');
75
const { markedTerminal } = require('marked-terminal');
@@ -21,22 +19,20 @@ const { SERVICE_URL } = process.env;
2119
* code snippet, and a screenshot file.
2220
* @param {String} errorMessage - The error message including stack trace.
2321
* @param {String} codeSnippet - A code snippet from the test case.
24-
* @param {String} screenshotPath - The file path to the screenshot image.
2522
* @param {Object} additionalDetails
2623
*/
27-
function sendErrorAnalysisRequest({errorMessage, codeSnippet, screenshotPath, additionalDetails}) {
28-
const form = new FormData();
24+
function sendErrorAnalysisRequest({errorMessage, codeSnippet, additionalDetails}) {
25+
const payload = {
26+
errorMessage,
27+
codeSnippet,
28+
additionalDetails
29+
};
2930

30-
form.append('errorMessage', errorMessage);
31-
form.append('codeSnippet', codeSnippet);
32-
form.append('additionalDetails', JSON.stringify(additionalDetails));
33-
form.append('screenshot', fs.createReadStream(screenshotPath));
34-
35-
const headers = form.getHeaders();
31+
const headers = { 'Content-Type': 'application/json' };
3632

3733
console.log('Running error analysis...');
3834

39-
return axios.post(SERVICE_URL, form, {
35+
return axios.post(SERVICE_URL, payload, {
4036
headers,
4137
httpsAgent: new https.Agent({
4238
rejectUnauthorized: false

0 commit comments

Comments
 (0)