ProtocolException: Expected ':status' header not present

后端 未结 4 1010
粉色の甜心
粉色の甜心 2020-12-05 19:06

Retrofit network calls fails with a Protocol Exception suddenly in a working app. The app was working till yesterday and today all the network calls fails. The calls works f

4条回答
  •  心在旅途
    2020-12-05 19:30

    I am using okhttp3 (okhttp-3.4.1), okhttp3 is not very compatible with the HTTP_1.1 protocol and needs to be manually added. you can see Official link

    OkHttpClient.Builder builder = new OkHttpClient.Builder();
    //protocols
    List protocols = new ArrayList();
    protocols.add(Protocol.HTTP_1_1);
    protocols.add(Protocol.HTTP_2);
    builder.protocols(protocols);
    

提交回复
热议问题