Is Retrofit+Okhttp using httpCaching as a default in Android?

前端 未结 3 907
悲&欢浪女
悲&欢浪女 2020-12-28 11:25

I use retrofit and okhttp in one of our applications.

I can\'t really find a good explanation for the default behaviour of Retrofit.

If Okhttp is on the cl

3条回答
  •  长情又很酷
    2020-12-28 11:50

    You should manually create your OkHttpClient and configure it how you like. In this case you should install a cache. Once you have that create an OkClient and pass it to Retrofit's RestAdapter.Builder

    Also, no caching for HTTP POST requests. GETs will be cached, however.

提交回复
热议问题