tap()
tap(callable $before = null, callable $after = null) : callable
Middleware that invokes a callback before and after sending a request.
The provided listener cannot modify or alter the response. It simply
"taps" into the chain to be notified before returning the promise. The
before listener accepts a request and options array, and the after
listener accepts a request, options array, and response promise.
Parameters
callable |
$before |
Function to invoke before forwarding the request. |
callable |
$after |
Function invoked after forwarding. |
Returns
callable
— Returns a function that accepts the next handler.