Comments (3)
To clarify: Since the lib itself calls the function, it would be the lib passing the
done
callback into it. We would then have to check if the function expects a fourth argument. Is this what you meant by activating async by a done callback?
Yes; although probably 4 arguments wouldn't be great to have. But we can discuss/change that once we have concrete code.
For example: if a user for some reason has defined a
beforeRedirect
function with four expected arguments, things would work fine today.
Ah well they shouldn't, it wasn't in our interface 😅
Personally, I think the promise pattern is the cleanest one.
Yes, but follow-redirects has a long compatibility history, with even some earlier versions of Node that did not have promises yet. But feel free to take a first stab at it, and we can discuss it from there.
from follow-redirects.
Thanks @olebor, that makes sense. For backward compatibility, we could activate async support if either a done
callback is passed as an argument or a promise is returned by the function.
from follow-redirects.
Cool!
To clarify: Since the lib itself calls the function, it would be the lib passing the done
callback into it. We would then have to check if the function expects a fourth argument. Is this what you meant by activating async by a done callback?
Adding a fourth done
parameter could potentially break some cases. For example: if a user for some reason has defined a beforeRedirect
function with four expected arguments, things would work fine today. But if we were to add a function as the fourth argument and expect it to be called before proceeding, this case would stop functioning.
Am I missing something?
Personally, I think the promise pattern is the cleanest one.
from follow-redirects.
Related Issues (20)
- Does not redirect while Axios works HOT 6
- To use with type module (import) HOT 8
- Configure module exports HOT 1
- destroy() is not properly handled
- socket is destroyed on timeout HOT 3
- esbuild --bundle hangs on debug.js
- CustomError implementation triggers the override mistake HOT 2
- Consider printing a warning when dropping confidential headers before redirecting from HTTP to HTTPS HOT 6
- Does not follow Google RSS news redirects HOT 1
- [Security Report] hostname spoofing via url.parse in follow-redirects HOT 5
- Call Error.captureStackTrace on firefox crash the app HOT 1
- Provide vX, vX.Y tags/branches besides vX.Y.Z with automation HOT 2
- axios auth does not seem to be propagated on redirect in 1.15.4+ HOT 6
- CVE-2023-26159 Vulnerability with version 1
- Request TIMEOUT ignores the config.timeout value HOT 2
- EMERGENT!!! huntr security reporting page is not working for follow-redirects HOT 2
- ### Describe the bug HOT 1
- Error.captureStackTrace is breaking the entire app on firefox HOT 3
- Replace deprecated `url.parse` HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from follow-redirects.