11const https = require ( 'https' ) ;
22const axios = require ( 'axios' ) ;
3- const FormData = require ( 'form-data' ) ;
4- const fs = require ( 'fs' ) ;
53const path = require ( 'path' ) ;
64const marked = require ( 'marked' ) ;
75const { 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