Is there a nice way to implement "blocking" request interceptor?
The main idea is that all requests should be intercepted and added additional header - token
.
If token
does not exist yet it should be retrieved first, then added to that request and cached for future used. token
is retrieved via API call.
I've tried to do synchronous request, but, that produces android.os.NetworkOnMainThreadException
. And implementing with in_progress
flags it doesn't look nice.