artemis icon indicating copy to clipboard operation
artemis copied to clipboard

Attempt at extending callbacks to include before request / after request

Open JanStevens opened this issue 6 years ago • 3 comments

From the ongoing discussion in #57 I took a small stab at it:

  • Extend Callbacks to include before_request and after_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

JanStevens avatar Feb 20 '19 09:02 JanStevens

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?

JanStevens avatar Feb 26 '19 07:02 JanStevens

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

JanStevens avatar Feb 26 '19 11:02 JanStevens

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!

yuki24 avatar Feb 27 '19 16:02 yuki24