forwardemail / forwardemail/superagent
TypeError: Cannot read property '_headerSent' of undefined
- Dominant language
- JavaScript
- Stars
- 16.6k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
I'm scraping a lot of urls in search of their RSS-feeds. Some errors just quit the whole script when encountering some domains, which is of course not desired behaviour. I tracked down one of the errors.
On line 967 of node/index.js is this:
`if (method !== 'HEAD' && !req._headerSent) {`
If I try to get "https://gtex.nl", the nodejs script exits with "TypeError: Cannot read property '_headerSent' of undefined". I know the url isn't working in browsers as well, but I think superagent has to throw an error, not stop the script entirely. So I wrote this above the current line 967:
`if (!req) {
console.log('Failed on url:', this.url)
return this.callback(new Error('Req object doesn\'t exist'));
}`
Now it doesn't exit the script and just throws an error I can catch. I don't know if this is a desired solution, but can this be fixed?
Edit: To avoid confusion, I'm not the owner of gtex.nl, so I can't change whatever they did wrong.
Contributor guide
Assessment
This issue has not been assessed yet.