Playing around I noticed a possible bug with maxRedirects. If its value is set to say 5 then up-to five redirects should be allowed after the main request, but it falls short by 1 (allowing only 4 redirects), due to opts.maxRedirects being decremented before the actual check in the code at https://github.com/feross/simple-get/blob/master/index.js#L47. I suppose it should rather be:
Hi, this is a neat little library.
Playing around I noticed a possible bug with
maxRedirects
. If its value is set to say5
then up-to five redirects should be allowed after the main request, but it falls short by 1 (allowing only 4 redirects), due toopts.maxRedirects
being decremented before the actual check in the code at https://github.com/feross/simple-get/blob/master/index.js#L47. I suppose it should rather be:It can be tested with this httpbin endpoint: https://httpbin.org/redirect/5
Also, I think the extra
parseOptsUrl(opts)
within the redirection handler code at https://github.com/feross/simple-get/blob/master/index.js#L44 isn't necessary, as it will be called at https://github.com/feross/simple-get/blob/master/index.js#L15 anyways on the next request.