TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Set-Cookie"]
andynuss opened this issue · 0 comments
andynuss commented
The following url fails every tim with the 1.5.14 (latest) secret-agent, on agent.goto():
https://www.sierraclub.org/sierra/racism-killing-planet
Here is a snippet of code:
import { Agent, ConnectionFactory, ConnectionToCore } from 'secret-agent';
const ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.209 Safari/537.36';
let sharedConnection: ConnectionToCore = null;
function getConnection (maxAgents: number): ConnectionToCore {
if (sharedConnection !== null) return sharedConnection;
sharedConnection = ConnectionFactory.createConnection({ maxConcurrency: maxAgents });
return sharedConnection;
}
async function test(): Promise<void> {
const agent: Agent = new Agent({
userAgent: ua,
connectionToCore: getConnection(1),
});
try {
await agent.goto('https://www.sierraclub.org/sierra/racism-killing-planet');
console.log('success');
} catch (e) {
console.log('failure', e);
} finally {
await agent.close();
}
}
(async () => {
await test();
})();
Here is the error:
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Set-Cookie"]