File tree Expand file tree Collapse file tree 3 files changed +11
-10
lines changed
Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -13,16 +13,7 @@ interface Ipeer {
1313 certificate ?: string ;
1414 x509Certificate ?: java . security . cert . Certificate ;
1515}
16- function wrapJavaException ( ex ) {
17- if ( ex instanceof java . lang . Exception ) {
18- const err = new Error ( ex . toString ( ) ) ;
19- err [ 'nativeException' ] = ex ;
20- //@ts -ignore
21- err [ 'stackTrace' ] = com . tns . NativeScriptException . getStackTraceAsString ( ex ) ;
22- return err ;
23- }
24- return ex ;
25- }
16+
2617const peer : Ipeer = {
2718 enabled : false ,
2819 allowInvalidCertificates : false ,
@@ -57,6 +48,10 @@ export function removeCachedResponse(url: string) {
5748 }
5849}
5950
51+ export function getManager ( ) {
52+ return getClient ( { } , false ) ;
53+ }
54+
6055// TODO: rewrite this to not have to handle
6156// every single property
6257let _timeout = 10 ;
Original file line number Diff line number Diff line change 11import { File , HttpRequestOptions , ImageSource } from '@nativescript/core' ;
22import * as Https from './request.common' ;
33
4+ export function getManager ( ) : any ; // okhttp3.OkHttpClient or AFHTTPSessionManager
5+
46export interface HttpsSSLPinningOptions {
57 host : string ;
68 certificate : string ;
Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ policies.def.validatesDomainName = false;
3939const configuration = NSURLSessionConfiguration . defaultSessionConfiguration ;
4040let manager = AFHTTPSessionManager . alloc ( ) . initWithSessionConfiguration ( configuration ) ;
4141
42+ export function getManager ( ) : AFHTTPSessionManager {
43+ return manager ;
44+ }
45+
4246export function enableSSLPinning ( options : HttpsSSLPinningOptions ) {
4347 const url = NSURL . URLWithString ( options . host ) ;
4448 manager = AFHTTPSessionManager . alloc ( ) . initWithSessionConfiguration ( configuration ) . initWithBaseURL ( url ) ;
You can’t perform that action at this time.
0 commit comments