Skip to content

Commit 5bc51b4

Browse files
committed
Merge pull request #80 from php-http/promise_result
Add promise resolution type
2 parents a543e94 + b17faa4 commit 5bc51b4

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

components/promise.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
Promise
22
=======
33

4-
When sending asynchronous HTTP requests, a promise is returned. The promise acts
5-
as a proxy for the response or error result, which is not yet known.
4+
A promise represents a single result of an asynchronous operation.
5+
It is not necessarily available at a specific time, but should become in the future.
6+
67
The PHP-HTTP promise follows the `Promises/A+`_ standard.
78

89
.. note::
@@ -13,8 +14,11 @@ The PHP-HTTP promise follows the `Promises/A+`_ standard.
1314
Asynchronous requests
1415
---------------------
1516

16-
Asynchronous requests enable non-blocking HTTP operations. To execute such a
17-
request with HTTPlug::
17+
Asynchronous requests enable non-blocking HTTP operations.
18+
When sending asynchronous HTTP requests, a promise is returned. The promise acts
19+
as a proxy for the response or error result, which is not yet known.
20+
21+
To execute such a request with HTTPlug::
1822

1923
$request = $messageFactory->createRequest('GET', 'http://php-http.org');
2024

@@ -27,6 +31,9 @@ request with HTTPlug::
2731

2832
See :ref:`message-factory` on how to use message factories.
2933

34+
Although the promise itself is not restricted to resolve a specific result type,
35+
in HTTP context it resolves a PSR-7 ``Psr\Http\Message\ResponseInterface`` or fails with an ``Http\Client\Exception``.
36+
3037
Wait
3138
----
3239

0 commit comments

Comments
 (0)