INNER CODE UNIT · JavaScript
formatPostString
guobao2333/DeepLX-Serverless · src/translate.js:8
function formatPostString(postData) {
let body = JSON.stringify(postData),
str = ((body.id + 5) % 29 === 0 || (body.id + 3) % 13 === 0) ? '"method" : "' : '"method": "';
body = body.replace('"method":"', str);
// console.log(body);
return body;
}
async function sendRequest(postData, urlMethod, dlSession, tagHandling, printResult) {
const urlFull = `${baseURL}/jsonrpc?`;
const headers = {
'Content-Type': 'application/json',
'User-Agent': 'DeepLBrowserExtension/1.28.0 Mozilla/5.0',
Accept: '*/*',
'Accept-Language': 'en-US,en;q=0.9',
Origin: 'https://www.deepl.com',
Referer: 'https://www.deepl.com/',