Closed periyasamyshanmugam closed 4 years ago
Hi, I am currently checking this out since it was reported by a couple of people as well. This is definitely a bug and will fix ASAP. Thanks for writing :)
Hi, @periyasamyshanmugam I've being trying to reproduce your problem but can't seem to get it. Could you post the piece of code where you are using either the HttpClientWithInterceptor
or the HttpWithInterceptor
to see if there is something wrong with the way you are using it?
Hi, @CodingAleCR First of all sorry for late reply.
Simply I want to modify my url params using below code.
Future<RequestData> interceptRequest({RequestData data}) async {
try {
data.params["tokenString"] = "XXXXXXXXXXX";
} catch (err) {
print(err);
}
return data;
}
This is my code where I am trying to add token string to my request params. But it is not reflecting in api request url.
Thanks.
No worries, here to help.
I understand that part, but I can't find any issues with the library. Are you using any of the options shown as followed for doing your request:
Using interceptors with Client
Client client = HttpClientWithInterceptor.build(interceptors: [
YourInterceptor(),
]);
Using interceptors without Client
var response = await HttpWithInterceptor
.build(interceptors: [YourInterceptor()])
.get("<change-with-your-url>");
@CodingAleCR Yes I am using without client.
HttpWithInterceptor.build(
interceptors: [TokenInterceptor(context)]).post(url, body: filter)
Like this. Is anything wrong in this?
There doesn't seem to be anything wrong with. the code, I will keep making tests to see if I am able to reproduce it. Is your context defined properly for your interceptor? Meaning, does it get assigned properly?
@CodingAleCR Yes I have defined and assigned my context properly.
Do you think maybe we could hop on a call and troubleshoot this problem? I am unable to reproduce it and I really want to help out the user's of the library. Cheers!
Hi There, i am facing same issue, on 401 API get called for token refresh , and new token get saved in shared preference (same printed in log also), but after that the old request get called without token. Is there is any way that i can modify request with new header before call in shouldAttemptRetryOnResponse method..??
Hi, what version of the library are you currently using? There was a bug that did not refresh interception after the first call and I'd like to verify if that is the issue you are having or if it's a different one. Thanks for writing!
Hi thank you for quick response , its really appreciable
Currently i m using http_interceptor: ^0.3.1 , and yes once after updating token on 401 the next call is not updated with latest data
Hi,Thanks i updated version http_interceptor: ^0.3.2 and issue resolved
I'm glad to hear that it was the issue I fixed recently 🎉 thanks for using the library and hopefully it helps you out a lot.
Hello, I am modifying my request url params in my interceptor but the modified params are not reflecting in my api call.
data.params["xyz"] = "mytoken"; this is how I am modifying the request params. Please, help me with this. Thanks.