samedi 2 juin 2018

How to temporarly disable SSL checks in retrofit

I have to call multiple endpoints hosting the same API and I use retrofit to handle the calls. Some of those endpoints don't have a SSL certificate. The solution described at Trusting all certificates with okHttp works for those.

Problem is: I need to disable the SSL checks only for those particular endpoints, but not for the other ones.

The only solution I could think of, is to use a singleton that uses a setter to trigger an re-instantiation with a different OkHttpClient that disables the SSL checks.

Is there a better solution to that problem?

Aucun commentaire:

Enregistrer un commentaire