I'm having issues with my node-fetch (specifically, node-fetch-cookies library). I'm supposed to get a string returning from a POST request like:
post_enc=9820CE922B01A166253A29384BA535D7BD08D94FC826A28C67403D19A45AF1CDF5E93DF40C029870DC0D8BD0DFBC9F36C521AF23E7D47CA2156BF917F3CC90B15A848873C3E851170E1C6738C570362E020BCB57FF189044EC611EA6FE2B843A69E248705008E9F2C1CF02030EADA9&post_chk=4A19
BUT I keep getting this instead:
post_enc=9820CE922B01A166253A29384BA535D7BD08D94FC826A28C67403D19A45AF1CDF5E93DF40C029870DC0D8BD0DFBC9F36C521AF23E7D47CA2156BF917F3CC90B15A848873C3E851170E1C6738C570362E020BCB57FF189044EC611EA6FE2B843A69E248705008E9F2C1CF02030EADA9DF4B6694940F35BB80FC9A4E9C6EEA57F08D858648E7979CCF83ADDDA8023E3E2893B6D2A59E86BA9531124251B43042F6F88A924E1B68C876967E2EBA29EEE34C4FD14C70BF0FDBC1A05B70FAC0476916F5C15F9136464D7187045EB>�022343040FB667B00AF2EAA230F90B00FD0E05A70A7102DE856FCB56656CFAB4FEF2C2139048B9CBB5370A500B2893623B61781↑☻¶�♀☻C�
I have tried removing any Accept-Encoding / Content-Encoding headers and I have tried to decode it using zlib but nothing seems to work.
Here's the exact code:
/** @type {any} */
let headers = {
'Content-Type': 'text/plain; charset=UTF-8',
'Content-Encoding': 'gzip, deflate, br', // I've tried removing this...
'Connection': 'keep-alive',
'Accept': '*/*',
'Accept-Language': 'fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7',
'Accept-Encoding': 'gzip, deflate, br', // I've tried removing this...
...cfg?.headers,
};
let cookieJar = null;
// Set the session cookie if the last Response had it.
if(this.SessionInfo.SessionCookie != "" && !isLogin) {
cookieJar = new CookieJar();
cookieJar.addCookie(this.SessionInfo.SessionCookie, uri);
headers = { ...headers, "Set-Cookie": this.SessionInfo.SessionCookie };
}
// Make the request.
cfg = { ...cfg, headers, compress: true };
const res = await fetch(cookieJar, uri, cfg);