ProtocolException: Expected ':status' header not present

后端 未结 4 1005
粉色の甜心
粉色の甜心 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:15

    I am using OkHttp2 (2.7.5) and I solved this issue by forcing the client to use HTTP 1.1 protocol

    OkHttpClient client = new OkHttpClient();
    client.setProtocols(Arrays.asList(Protocol.HTTP_1_1)); // <- add this line
    

提交回复
热议问题