Giter Site home page Giter Site logo

Comments (4)

yale8848 avatar yale8848 commented on August 25, 2024

请帖上代码看看

from retrofitcache.

gzsll avatar gzsll commented on August 25, 2024

@OverRide
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
// Add access_token parameter if user login
UserInfo userInfo = mFRVAccountManager.getUserInfo();
String accessToken = userInfo != null ? userInfo.token() : null;
HttpUrl originalUrl = request.url();
if (!TextUtils.isEmpty(accessToken) && originalUrl != null && TextUtils.isEmpty(originalUrl.queryParameter("access_token"))) {
HttpUrl url = originalUrl.newBuilder().addEncodedQueryParameter("access_token", accessToken).build();
request = request.newBuilder().url(url).build();
}
return chain.proceed(request);
}
通过intercept添加access_token

from retrofitcache.

yale8848 avatar yale8848 commented on August 25, 2024

你自己给url添加新的字段,导致原始请求url链接发生变化,最后找不到这个新的链接,cache time就成默认值了;
我下版本再想办法兼容处理一下这个问题

from retrofitcache.

yale8848 avatar yale8848 commented on August 25, 2024

请更新至1.0.7
RetrofitCache.getInstance().addIgnoreParam("access_token");

from retrofitcache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.