Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpClient] HttplugClient::sendAsyncRequest doesn't always return full promise implementation #37488

Closed
@bohanyang

Description

@bohanyang

Symfony version(s) affected: 4.x, 5.x

Description

return new RejectedPromise($e);

RejectedPromise returned here is Http\Promise\RejectedPromise, but not the full implementation like Symfony\Component\HttpClient\Response\HttplugPromise (as in docblock @return)
This can cause problem. For example, promises returned by then functions will be treated as plain value.

The code:
https://github.com/php-http/promise/blob/02ee67f2346b4eec3861afec741c656f5ff717ab/src/RejectedPromise.php

How Guzzle promise settle promises:
https://github.com/guzzle/promises/blob/bbf3b200bc83c1e9298580a9f99b9be248543467/src/RejectedPromise.php#L40
https://github.com/guzzle/promises/blob/bbf3b200bc83c1e9298580a9f99b9be248543467/src/Promise.php#L108

How to reproduce

https://github.com/brentybh/symfony-37488
Sorry, it's not finished yet.
Because I have to bring in a retry middleware.
The Httplug simple promise CAN cover most simple use cases. But the retry middleware implementation is different...
Possible Solution

emm.. Maybe it's not strictly an issue of Symfony but a problem of Httplug....
Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions