如何解决okhttp3.internal.http2.StreamResetException:流已重置:改装POST请求中的REFUSED_STREAM

问题描述 投票:2回答:1

我正在使用改造将数据传递到服务器。但是得到以下异常响应:

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'

仍然无法解决问题。如何解决?

android retrofit2 okhttp3
1个回答
0
投票

为时已晚,您可能已解决此问题,但就我而言,我解决了在OKHttpClient中添加协议的问题:

OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); 
httpClient.protocols( Collections.singletonList(Protocol.HTTP_1_1) );

问候!

© www.soinside.com 2019 - 2024. All rights reserved.