标签:err code http prot tpc image class protocol color
昨天在做Android接口调用的时候,api接口是https的,用okhttp抛出:
okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR
原因是协议错误导致的,解决办法很简单,在实例化okhttpclient的时候用以下方法:
OkHttpClient client = new OkHttpClient.Builder() .protocols(Collections.singletonList(Protocol.HTTP_1_1)) .build();
完美解决。
解决okHttp使用https抛出stream was reset: PROTOCOL_ERROR的问题
标签:err code http prot tpc image class protocol color
原文地址:http://www.cnblogs.com/myhalo/p/6811472.html