rbren / rss-parser

A lightweight RSS parser, for Node and the browser
MIT License
1.38k stars 209 forks source link

maxRedirects option cannot be set to 0 #256

Open jbenezech opened 1 year ago

jbenezech commented 1 year ago

Because of falsy value checks, when maxRedirects is set to zero, it defaults to _DEFAULT_MAXREDIRECTS.

A workaround to disallow redirects is to instantiate the parser with maxRedirects to 1 and pass this value in the parseURL function

const parser = new Parser<Record<string, unknown>>({maxRedirects: 1});
const feed = await parser.parseURL(url, undefined, 1);
rbren commented 1 year ago

Good catch! Happy to accept a PR here