|
22 | 22 | ///
|
23 | 23 | /// Every interceptor has the opportunity to perform asynchronous work before passing a potentially
|
24 | 24 | /// altered value to the next interceptor in the chain. When the end of the chain is reached, the
|
25 |
| -/// final value is passed to the networking client where it is sent to the server (outbound request) |
26 |
| -/// or to the caller (inbound response). |
| 25 | +/// final value is passed to the networking client, where it is sent to the server |
| 26 | +/// (outbound request) or to the caller (inbound response). |
27 | 27 | ///
|
28 |
| -/// Interceptors may also fail outbound requests before they're sent, thus preventing subsequent |
29 |
| -/// interceptors from being invoked and returning a specified error back to the original caller. |
| 28 | +/// Interceptors may also fail outbound requests before they are sent; subsequent |
| 29 | +/// interceptors in the chain will not be invoked, and the error will be returned to the |
| 30 | +/// original caller. |
30 | 31 | ///
|
31 |
| -/// Interceptors are closure-based and are passed both the current value and a closure which |
| 32 | +/// Interceptors are closure-based and receive both the current value and a closure that |
32 | 33 | /// should be called to resume the interceptor chain. Propagation will not continue until
|
33 |
| -/// this closure is called. Additional values may still be passed to a given interceptor even |
| 34 | +/// this closure is invoked. Additional values may still be passed to a given interceptor even |
34 | 35 | /// though it has not yet continued the chain with a previous value. For example:
|
35 | 36 | ///
|
36 |
| -/// - A request is sent |
37 |
| -/// - Response headers are received, and an interceptor pauses the chain while processing them |
38 |
| -/// - First chunk of streamed data is received, and the interceptor is invoked with this value |
39 |
| -/// - Interceptor is expected to resume with headers first, and then with data after |
| 37 | +/// 1. A request is sent |
| 38 | +/// 2. Response headers are received, and an interceptor pauses the chain while processing them |
| 39 | +/// 3. The first chunk of streamed response data is received, and the interceptor is invoked with |
| 40 | +/// this value |
| 41 | +/// 4. The interceptor is expected to resume with headers first, and then with data after |
40 | 42 | ///
|
41 | 43 | /// Implementations should be thread-safe (hence the `Sendable` requirement on interceptor
|
42 | 44 | /// closures), as closures can be invoked from different threads during the span of a request or
|
|
0 commit comments