artemis
artemis copied to clipboard
Attempt at extending callbacks to include before request / after request
From the ongoing discussion in #57 I took a small stab at it:
- Extend
Callbacks
to includebefore_request
andafter_request
callbacks - Pass the callbacks to the Executor so they can be passed in the execute
I didn't really find a better way to pass the callbacks to the adapters, this renders the Executor
a bit useless. I think the code can be refactored a bit more (especially the adapter part) so execute is not that big of a method.
Didn't add specs yet, lets first see if this POC is in the right direction
Thanks for you input, when coding this I did felt the same. I'm quite happy now with my own adapter implementation that is used in production.
Should I persuade this merge request or leave it for now?
I put my custom adapter in a gem: https://github.com/JanStevens/artemis-api-auth/tree/master
Indeed not that hard to add it, probably a better way to register new adapters would be handy
Thanks for all the contributions you've made @JanStevens! I'll add your adapter to README. I also wasn't aware of the fact that the HMAC authentication could be abstracted the way the api_auth
does - it might be worthwhile adding built-in support for that if that's common.
Let's also leave this issue open. I think this PR has good amount of context that others can look at and a generic request interceptor may be helpful for other things in the future. Thanks again for all the work you've done!