Kann keine Multi -Form -Postanforderung über JS ohne Fehler ausführenJavaScript

Javascript-Forum
Anonymous
 Kann keine Multi -Form -Postanforderung über JS ohne Fehler ausführen

Post by Anonymous »

Erste Frage < /li>
< /ol>
Ich habe eine Route, die in Schlaflosigkeit arbeitet, die als \ mit einer multiformen Option geschickt wird.import FormData from 'form-data';
import fetch from 'node-fetch';
import https from 'https';

// process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';

const form = new FormData();
form.append("...", "...");
form.append("...", "...");
form.append("...", "...");
form.append("...", "...");

// Following block is to bypass wht authorization
const httpsAgent = new https.Agent({
rejectUnauthorized: false,
});

const options = {
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data; boundary=---011000010111000001101001',
// 'User-Agent': 'insomnia/2023.5.8',
'agent': httpsAgent, // This Line is to bypass wht authorization
}
};

options.body = form;

fetch('https:XXXXX', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
< /code>
Wenn ich keine Formdata hinzufüge, kann ich keine multiforme Option erstellen
Wenn ich nicht httpagent hinzufüge, kann ich SSL nicht vermeiden. /> Zweite Frage
Wie ich bereits sagte, habe ich diese Route ordnungsgemäß unter Schlaflosigkeit
Wie kann ich eine bestimmte Anfrage (von außerhalb von Schlaflosigkeit) aufrufen und alle xxx -Sekunden ausführen? Kann dies automatisch erfolgen?>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post