Przeglądaj źródła

Refactored `authorizationHeader` API to drop the `From`…no functional changes.

Christian Noon 9 lat temu
rodzic
commit
004b315623

+ 1 - 1
Source/Request.swift

@@ -168,7 +168,7 @@ open class Request {
     /// - parameter password: The password.
     ///
     /// - returns: A tuple with Authorization header and credential value if encoding succeeds, `nil` otherwise.
-    open static func authorizationHeaderFrom(user: String, password: String) -> (key: String, value: String)? {
+    open static func authorizationHeader(user: String, password: String) -> (key: String, value: String)? {
         guard let data = "\(user):\(password)".data(using: .utf8) else { return nil }
 
         let credential = data.base64EncodedString(options: [])

+ 1 - 1
Tests/AuthenticationTests.swift

@@ -130,7 +130,7 @@ class BasicAuthenticationTestCase: AuthenticationTestCase {
 
         var headers: [String: String]?
 
-        if let authorizationHeader = Request.authorizationHeaderFrom(user: user, password: password) {
+        if let authorizationHeader = Request.authorizationHeader(user: user, password: password) {
             headers = [authorizationHeader.key: authorizationHeader.value]
         }
 

+ 1 - 1
Tests/SessionManagerTests.swift

@@ -55,7 +55,7 @@ class SessionManagerTestCase: BaseTestCase {
             adaptedCount += 1
 
             if shouldApplyAuthorizationHeader && adaptedCount > 1 {
-                if let header = Request.authorizationHeaderFrom(user: "user", password: "password") {
+                if let header = Request.authorizationHeader(user: "user", password: "password") {
                     urlRequest.setValue(header.value, forHTTPHeaderField: header.key)
                 }
             }