Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxRedirects option cannot be set to 0 #256

Open
jbenezech opened this issue Oct 5, 2023 · 1 comment
Open

maxRedirects option cannot be set to 0 #256

jbenezech opened this issue Oct 5, 2023 · 1 comment

Comments

@jbenezech
Copy link

jbenezech commented Oct 5, 2023

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

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
Copy link
Owner

rbren commented Oct 5, 2023

Good catch! Happy to accept a PR here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants