-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The diff is ugly but I just: - removed the try block - moved the code after the catch blocks inside the first closure argument of `then` - changed the catch blocks into `if`s with `instanceof` checks - moved them to the second closure argument of `then` - replaced `fetch` with `fetchAsync` Unfortunately, HTTPlug’s `HttpFulfilledPromise` is broken (does not allow to be converted to another promise type and only supports resolving with `ResponseInterface`) so we need the ugly hack in `makePromise` to convert it into a promise object from a full-fledged promise library. I considered ReactPHP’s promise library first but those promises are not natively waitable in version 2.0 and using custom busy-loop waiting or third-party wait (from choval/async) just seemed to block. In the end, I went with Guzzle’s promise library.
- Loading branch information
Showing
2 changed files
with
156 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters