You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The SparkPostPromise::then function does not return the result of the callback functions. This means the new promise that it returns will have no data.
$result = $sparky->request(...)->then(function($response) {
// do somethingreturn$response;
})->wait();
// $result is now null!
This is important if we want to add our own middleware to transform the response.
SparkPostPromise::then could be restructured like this to fix the issue (happy to open a PR if this is suitable):
publicfunction then(callable$onFulfilled = null, callable$onRejected = null)
{
$request = $this->request;
return$this->promise->then(function ($response) use ($request) {
returnnewSparkPostResponse($response, $request);
}, function ($exception) use ($request) {
returnnewSparkPostException($exception, $request)
})->then($onFulfilled, $onRejected);
}
The text was updated successfully, but these errors were encountered:
The
SparkPostPromise::then
function does not return the result of the callback functions. This means the new promise that it returns will have no data.This is important if we want to add our own middleware to transform the response.
SparkPostPromise::then
could be restructured like this to fix the issue (happy to open a PR if this is suitable):The text was updated successfully, but these errors were encountered: