-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
Properly return a bluebird promise #8988
Conversation
refs TryGhost#8980 -☹️ apparently this is actually the only way
@AileenCGN Could you please add a test for this PR? And could you double check the I would like to figure out if we can remove the promise wrapper, because of 7353c87. |
refs #9178 - next steps are to A: test if global.Promise works with `got` (see #8988 (comment)) B: re-use request utility everywhere C: request lib requires data/validator, which is dirty
If I remember correctly, we had to wrap the |
So we need to test if we can now remove this because of ^. Do you have time to check that? |
I will check tomorrow and try to optimise the tests which needed this wrap. |
That is cool! |
refs TryGhost#9178, refs TryGhost#8988 With TryGhost@7353c87 we use Bluebird globally for Promises. Therefore, the request lib doesn't need to be wrapped in a bluebird Promise anymore. This was originally done, so we can work with catch predicated in our image-size lib. Updated the tests to proof, that the catch predicates work. The tests fail, as soon as the Promise overwrite is commented out.
refs #9178, refs #8988 With 7353c87 we use Bluebird globally for Promises. Therefore, the request lib doesn't need to be wrapped in a bluebird Promise anymore. This was originally done, so we can work with catch predicated in our image-size lib. Updated the tests to proof, that the catch predicates work. The tests fail, as soon as the Promise overwrite is commented out.
This really didn't make sense to me at first - but the problem is that got() itself returns the wrong kind of promise. We have to instead wrap it. Really annoying because it makes for ugly code, but this is the only way to make sure we can use function predicates everywhere.
FYI I have this wrong in other code 🙈 😞
refs #8980