This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Description
Response:
{ status code: 401, headers {
"Cache-Control" = private;
"Content-Language" = en;
"Content-Length" = 951;
"Content-Type" = "text/html;charset=utf-8";
Date = "Tue, 29 May 2018 07:32:43 GMT";
Expires = "Thu, 01 Jan 1970 08:00:00 CST";
Server = "Apache-Coyote/1.1";
"Www-Authenticate" = "Digest realm="My Realm", qop="auth", nonce="1527579163026:3643c85f69be9ac55a4a42d87fe69dab", opaque="A09625523209ADC9E967098F1F0C1491"";
} }
After above response, I can't print next Request content, include ‘Authenticate’!
This is deal Challenge code:
[self.sessionManager setSessionDidReceiveAuthenticationChallengeBlock:^NSURLSessionAuthChallengeDisposition(NSURLSession * _Nonnull session, NSURLAuthenticationChallenge * _Nonnull challenge, NSURLCredential *__autoreleasing _Nullable * _Nullable credential) {
*credential = [[NSURLCredential alloc] initWithUser:@"tomcat" password:@"tomcat" persistence:NSURLCredentialPersistenceForSession];
return NSURLSessionAuthChallengeUseCredential;
}];
[self.sessionManager setTaskDidReceiveAuthenticationChallengeBlock:^NSURLSessionAuthChallengeDisposition(NSURLSession * _Nonnull session, NSURLSessionTask * _Nonnull task, NSURLAuthenticationChallenge * _Nonnull challenge, NSURLCredential *__autoreleasing _Nullable * _Nullable credential) {
*credential = [[NSURLCredential alloc] initWithUser:@"tomcat" password:@"tomcat" persistence:NSURLCredentialPersistenceForSession];
return NSURLSessionAuthChallengeUseCredential;
}];
