Skip to content

Commit 17f8488

Browse files
committed
review: apply suggestions
1 parent 2a9fee0 commit 17f8488

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ios/RCTHTTPRequestHandler+AuthenticationChallenge.m

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#import <Security/Security.h>
55

66
/**
7-
* There will be only one instance of this class on runtime accordinly the React Native code.
7+
* There will be only one instance of this class at runtime according to the React Native code.
88
* This provides a good opportunity to cache data on the class itself.
99
*/
1010
@implementation RCTHTTPRequestHandler (AuthenticationChallengeExtension)
@@ -110,15 +110,15 @@ - (void)authenticationChallenge_URLSession:(NSURLSession *)session
110110
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
111111
}
112112
} else {
113-
NSLog(@"Certificate not set.");
113+
CFStringRef errorMessage = SecCopyErrorMessageString(status, NULL);
114+
NSLog(@"Certificate not set to the trust entity. Reason: %@", (__bridge NSString *)errorMessage);
114115
// Cancel the authentication challenge
115116
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
116117
}
117118
} else {
118119
// Trust is not of type ServerTrust, proceeding with default challenge, if any
119120
NSLog(@"Not ServerTrust challenge. Calling default authentication challenge.");
120-
// For other authentication methods, call the original implementation
121-
[self authenticationChallenge_URLSession:session didReceiveChallenge:challenge completionHandler:completionHandler];
121+
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
122122
}
123123
}
124124

@@ -151,7 +151,7 @@ - (SecCertificateRef)getCert:(NSString *)certFilename {
151151

152152
if (!certData) {
153153
@throw [NSException exceptionWithName:NSInternalInconsistencyException
154-
reason:[NSString stringWithFormat:@"%@ not found", certFilename]
154+
reason:[NSString stringWithFormat:@"Certificate file %@.der not found", certFilename]
155155
userInfo:nil];
156156
}
157157

0 commit comments

Comments
 (0)