Client should support middleware
There's a use case for StrataClient.request() to have middleware configured for it. This would allow us to do things like implement caching strategies for service-to-service calls, as well as detect calls to ourselves and handle that internally without hitting the queue.
What's great is the middleware api shouldn't need to change for this at all. Thought, there is the question of if we need to make a distinction between client middleware and service middleware. There are cases where the logic might be different, but there's a good chance this can be handled by convention, and not necessarily by code.
In the client case:
-
beforeRequest- called before the request is made, passed the generated request object. -
success- called after the request is made, in the event it succeeded. -
failure- called after the request is made, in the event it fails.
Edited by Christopher Case