Open bai-xuan opened 10 months ago
Thanks @bai-xuan for filing this issue. I have a doubt about your solution. Wouldn't that code replace any interceptor added previously?
Thanks @bai-xuan for filing this issue. I have a doubt about your solution. Wouldn't that code replace any interceptor added previously?
An immutable list will definitely not take effect, and he even reported an error
Thanks @bai-xuan for filing this issue. I have a doubt about your solution. Wouldn't that code replace any interceptor added previously?
toImmutableList() The implementation is:
/* Returns an immutable copy of this. /
fun
It has been explained in detail in unmodifiableList:
Let me add one more thing, in okhttp-2.7.5 The implementation of interceptors is like this:
What I'm talking about is using --library okhttp4-gson His okhttp version is 4.10.0:
This is the implementation in version 4.10.0:
Specific code: https://github.com/square/okhttp/blob/6b07f6227416506a44bb97012551929cd6a1dd79/okhttp/src/main/kotlin/okhttp3/OkHttpClient.kt#L134
The version I'm using is:3.0.50
Set debug mode, httpClient should not add Interceptor through httpClient.interceptors().add()
Because httpClient.interceptors() returns views that cannot be modified. The specific situation is as follows:
. My solution is: