我正在使用改造将数据传递到服务器。但是得到以下异常响应:
okhttp3.internal.http2.StreamResetException:流已重置:REFUSED_STREAM
我引用了以下链接以获取上述例外:java.io.IOException: stream was reset: REFUSED_STREAM on several devices
并将更新版本和okhttp版本更新为以下版本:
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.5.0'
仍然无法解决问题。如何解决?
为时已晚,您可能已解决此问题,但就我而言,我解决了在OKHttpClient
中添加协议的问题:
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
httpClient.protocols( Collections.singletonList(Protocol.HTTP_1_1) );
问候!