Can't call chain more than once in interceptor
murat-mehmet opened this issue · 0 comments
murat-mehmet commented
If we create an interceptor and call the chain more than once, we get an error:
let response = await chain(request);
response2 = await chain(request);
...
[TypeError: interceptors[i++] is not a function. (In 'interceptors[i++](chainStep, request)', 'interceptors[i++]' is undefined)]
I need to call chain twice in my auth interceptor, if the token is expired, I refresh token and reissue the request. This functionality was working great in android java ok-http interceptors. I think we can fix this with a little tweak in code. I will send a PR soon.