Closed alessioalex closed 4 years ago
@mcollina done!
ping @feross
I don't think this feature should be added. So far this module focuses on the essential features - matching the name "simple-get". This new feature is only useful for special use cases. If at some point all imaginable use cases are supported, this module has probably lost its wonderful simplicity. But maybe I misjudge the frequency with which this feature is needed.
I think this is a valid and simple use case. Furthermore the change only adds an extra condition (34 chars) to an if statement. I don't think the module should automatically follow redirects no matter the situation.
ping @feross
What about calling it with
get({url, maxRedirects: 0}, cb)
Maybe just a matter of documentating maxRedirects
?
@millette Nice idea to use get({url, maxRedirects: 0}, cb)
but an error is thrown when too many redirects have happened, so this just throws an error instead of allowing the user to see the response.
@alessioalex Thanks for the PR, this looks good to me.
3.1.0
thanks @feross
Use cases:
Black friday online shops, get notified when they are up
New releases for game web applications, such as Fifa 19
etc