1 | <?php declare(strict_types=1); |
||
13 | final class Middleware implements MiddlewareInterface |
||
14 | { |
||
15 | /** |
||
16 | * Return the processed $request via a fulfilled promise. |
||
17 | * When implementing cache or other feature that returns a response, do it with a rejected promise. |
||
18 | * If neither is possible, e.g. on some kind of failure, resolve the unaltered request. |
||
19 | * |
||
20 | * @param RequestInterface $request |
||
21 | * @param array $options |
||
22 | * @return CancellablePromiseInterface |
||
23 | */ |
||
24 | 2 | public function pre( |
|
32 | |||
33 | /** |
||
34 | * Return the processed $response via a promise. |
||
35 | * |
||
36 | * @param ResponseInterface $response |
||
37 | * @param array $options |
||
38 | * @return CancellablePromiseInterface |
||
39 | */ |
||
40 | 1 | public function post( |
|
48 | |||
49 | /** |
||
50 | * Deal with possible errors that occurred during request/response events. |
||
51 | * |
||
52 | * @param Throwable $throwable |
||
53 | * @param array $options |
||
54 | * @return CancellablePromiseInterface |
||
55 | */ |
||
56 | 1 | public function error( |
|
64 | } |
||
65 |