Browse Source

Including delegate credential in cURL representation

Mattt Thompson 11 years ago
parent
commit
f397f67f95
1 changed files with 6 additions and 4 deletions
  1. 6 4
      Source/Alamofire.swift

+ 6 - 4
Source/Alamofire.swift

@@ -875,10 +875,12 @@ extension Request: DebugPrintable {
         if let credentialStorage = self.session.configuration.URLCredentialStorage {
         if let credentialStorage = self.session.configuration.URLCredentialStorage {
             let protectionSpace = NSURLProtectionSpace(host: URL.host!, port: URL.port ?? 0, `protocol`: URL.scheme, realm: URL.host, authenticationMethod: NSURLAuthenticationMethodHTTPBasic)
             let protectionSpace = NSURLProtectionSpace(host: URL.host!, port: URL.port ?? 0, `protocol`: URL.scheme, realm: URL.host, authenticationMethod: NSURLAuthenticationMethodHTTPBasic)
             if let credentials = credentialStorage.credentialsForProtectionSpace(protectionSpace)?.values.array {
             if let credentials = credentialStorage.credentialsForProtectionSpace(protectionSpace)?.values.array {
-                if !credentials.isEmpty {
-                    if let credential = credentials[0] as? NSURLCredential {
-                        components.append("-u \(credential.user):\(credential.password)")
-                    }
+                for credential: NSURLCredential in (credentials as [NSURLCredential]) {
+                    components.append("-u \(credential.user):\(credential.password)")
+                }
+            } else {
+                if let credential = self.delegate.credential {
+                    components.append("-u \(credential.user):\(credential.password)")
                 }
                 }
             }
             }
         }
         }