CodingAleCR / http_interceptor

A lightweight, simple plugin that allows you to intercept request and response objects and modify them if desired.
MIT License
134 stars 67 forks source link

Fix: Convert shouldAttemptRetryOnResponse to a Future. #25

Closed SuperWes closed 4 years ago

SuperWes commented 4 years ago

Convert shouldAttemptRetryOnResponse to return a Future so that a token refresh can happen asynchronously.

CodingAleCR commented 4 years ago

Thank you @SuperWes. I will make a new patch release for this in the next couple of days, everything looks good but I'd like to make some tests. Nice catch by the way!

SuperWes commented 4 years ago

Thanks! It was less of a "catch", and more something we just ran into when trying to use the framework. Nice framework though! If you'd like us to write the tests we can help out there. Just let me know!

CodingAleCR commented 4 years ago

You are more than welcome to write as many tests as you want of course. Thanks again for the great support and compliments! 🥳

SuperWes commented 4 years ago

Well, I wrote 'a' test, but it's not that great. The most useful test would be against the HttpClientWithInterceptor itself, and that's not really feasible without a larger refactoring where you can inject a mock client and control the responses.

CodingAleCR commented 4 years ago

Ugh, yeah I know, sorry for that, I've being trying to pull that one up for a while and hopefully will get to it soon enough. Thanks for the test added and for the effort on this PR. I will merge it and release ASAP. 🥳