@@ -30,7 +30,8 @@ export function setCache(options?: CacheOptions) {
3030 cache = null ;
3131 }
3232 if ( Client ) {
33- getClient ( true ) ;
33+ //we need to force a new client for the builder to use cache
34+ getClient ( undefined , true ) ;
3435 }
3536}
3637export function clearCache ( ) {
@@ -221,18 +222,18 @@ export function enableSSLPinning(options: HttpsSSLPinningOptions) {
221222 }
222223 }
223224 peer . enabled = true ;
224- getClient ( true ) ;
225+ getClient ( undefined , true ) ;
225226}
226227
227228export function disableSSLPinning ( ) {
228229 peer . enabled = false ;
229- getClient ( true ) ;
230+ getClient ( undefined , true ) ;
230231}
231232
232233let Client : okhttp3 . OkHttpClient ;
233234let cookieJar : com . nativescript . https . QuotePreservingCookieJar ;
234235let cookieManager : java . net . CookieManager ;
235- function getClient ( reload : boolean = false , opts : Partial < HttpsRequestOptions > = { } ) : okhttp3 . OkHttpClient {
236+ export function getClient ( opts : Partial < HttpsRequestOptions > = { } , reload : boolean = false ) : okhttp3 . OkHttpClient {
236237 if ( ! Client ) {
237238 // ssl error fix on KitKat. Only need to be done once.
238239 // client will be null only onced so will run only once
@@ -409,7 +410,7 @@ const runningClients: { [k: string]: okhttp3.OkHttpClient } = {};
409410
410411let OkHttpResponse : typeof com . nativescript . https . OkHttpResponse ;
411412export function createRequest ( opts : HttpsRequestOptions , useLegacy : boolean = true ) : HttpsRequest {
412- const client = getClient ( false , opts ) ;
413+ const client = getClient ( opts , false ) ;
413414
414415 const request = new okhttp3 . Request . Builder ( ) ;
415416 request . url ( opts . url ) ;
0 commit comments