提交 ade5a2e1 编写于 作者: C Christian Noon

Refactored Manager class to SessionManager to be more descriptive.

上级 a94323c6
......@@ -143,8 +143,8 @@
4CCB20771D4549E000C64D5B /* expired.badssl.com-intermediate-ca-2.cer in Resources */ = {isa = PBXBuildFile; fileRef = 4CCB206B1D4549E000C64D5B /* expired.badssl.com-intermediate-ca-2.cer */; };
4CCFA79A1B2BE71600B6F460 /* URLProtocolTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CCFA7991B2BE71600B6F460 /* URLProtocolTests.swift */; };
4CCFA79B1B2BE71600B6F460 /* URLProtocolTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CCFA7991B2BE71600B6F460 /* URLProtocolTests.swift */; };
4CDE2C371AF8932A00BABAE5 /* Manager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C361AF8932A00BABAE5 /* Manager.swift */; };
4CDE2C381AF8932A00BABAE5 /* Manager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C361AF8932A00BABAE5 /* Manager.swift */; };
4CDE2C371AF8932A00BABAE5 /* SessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C361AF8932A00BABAE5 /* SessionManager.swift */; };
4CDE2C381AF8932A00BABAE5 /* SessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C361AF8932A00BABAE5 /* SessionManager.swift */; };
4CDE2C3A1AF899EC00BABAE5 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C391AF899EC00BABAE5 /* Request.swift */; };
4CDE2C3B1AF899EC00BABAE5 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C391AF899EC00BABAE5 /* Request.swift */; };
4CDE2C3D1AF89D4900BABAE5 /* Download.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C3C1AF89D4900BABAE5 /* Download.swift */; };
......@@ -165,7 +165,7 @@
4CF627061BA7CBE30011A099 /* Alamofire.h in Headers */ = {isa = PBXBuildFile; fileRef = F8111E3819A95C8B0040E7D1 /* Alamofire.h */; settings = {ATTRIBUTES = (Public, ); }; };
4CF627071BA7CBF60011A099 /* Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = F897FF4019AA800700AB5182 /* Alamofire.swift */; };
4CF627081BA7CBF60011A099 /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C1DC8531B68908E00476DE3 /* Error.swift */; };
4CF627091BA7CBF60011A099 /* Manager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C361AF8932A00BABAE5 /* Manager.swift */; };
4CF627091BA7CBF60011A099 /* SessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C361AF8932A00BABAE5 /* SessionManager.swift */; };
4CF6270A1BA7CBF60011A099 /* ParameterEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CE2724E1AF88FB500F1D59A /* ParameterEncoding.swift */; };
4CF6270B1BA7CBF60011A099 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C391AF899EC00BABAE5 /* Request.swift */; };
4CF6270C1BA7CBF60011A099 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C0E5BF71B673D3400816CCC /* Result.swift */; };
......@@ -178,7 +178,7 @@
4CF627131BA7CBF60011A099 /* Validation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C421AF89F0900BABAE5 /* Validation.swift */; };
4CF627141BA7CC240011A099 /* BaseTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C256A501B096C2C0065714F /* BaseTestCase.swift */; };
4CF627151BA7CC240011A099 /* AuthenticationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8E6024419CB46A800A3E7F1 /* AuthenticationTests.swift */; };
4CF627161BA7CC240011A099 /* ManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8D1C6F419D52968002E74FE /* ManagerTests.swift */; };
4CF627161BA7CC240011A099 /* SessionManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8D1C6F419D52968002E74FE /* SessionManagerTests.swift */; };
4CF627171BA7CC240011A099 /* ParameterEncodingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E5C19A9674D0040E7D1 /* ParameterEncodingTests.swift */; };
4CF627181BA7CC240011A099 /* RequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E5D19A9674D0040E7D1 /* RequestTests.swift */; };
4CF627191BA7CC240011A099 /* ResponseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E5E19A9674D0040E7D1 /* ResponseTests.swift */; };
......@@ -201,7 +201,7 @@
E4202FD01B667AA100C997FB /* ParameterEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CE2724E1AF88FB500F1D59A /* ParameterEncoding.swift */; };
E4202FD11B667AA100C997FB /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C391AF899EC00BABAE5 /* Request.swift */; };
E4202FD21B667AA100C997FB /* ResponseSerialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C451AF89FF300BABAE5 /* ResponseSerialization.swift */; };
E4202FD31B667AA100C997FB /* Manager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C361AF8932A00BABAE5 /* Manager.swift */; };
E4202FD31B667AA100C997FB /* SessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C361AF8932A00BABAE5 /* SessionManager.swift */; };
E4202FD41B667AA100C997FB /* Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = F897FF4019AA800700AB5182 /* Alamofire.swift */; };
E4202FD51B667AA100C997FB /* MultipartFormData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C23EB421B327C5B0090E0BC /* MultipartFormData.swift */; };
E4202FD61B667AA100C997FB /* ServerTrustPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C811F8C1B51856D00E0F59A /* ServerTrustPolicy.swift */; };
......@@ -214,7 +214,7 @@
F829C6B81A7A94F100A2CD59 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DD67C0B1A5C55C900ED2280 /* Alamofire.framework */; };
F829C6BE1A7A950600A2CD59 /* ParameterEncodingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E5C19A9674D0040E7D1 /* ParameterEncodingTests.swift */; };
F829C6BF1A7A950600A2CD59 /* RequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E5D19A9674D0040E7D1 /* RequestTests.swift */; };
F829C6C01A7A950600A2CD59 /* ManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8D1C6F419D52968002E74FE /* ManagerTests.swift */; };
F829C6C01A7A950600A2CD59 /* SessionManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8D1C6F419D52968002E74FE /* SessionManagerTests.swift */; };
F829C6C11A7A950600A2CD59 /* ResponseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E5E19A9674D0040E7D1 /* ResponseTests.swift */; };
F829C6C21A7A950600A2CD59 /* UploadTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E5F19A9674D0040E7D1 /* UploadTests.swift */; };
F829C6C31A7A950600A2CD59 /* DownloadTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E5B19A9674D0040E7D1 /* DownloadTests.swift */; };
......@@ -226,7 +226,7 @@
F8858DDE19A96B4400F55F93 /* ResponseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E5E19A9674D0040E7D1 /* ResponseTests.swift */; };
F897FF4119AA800700AB5182 /* Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = F897FF4019AA800700AB5182 /* Alamofire.swift */; };
F8AE910219D28DCC0078C7B2 /* ValidationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8AE910119D28DCC0078C7B2 /* ValidationTests.swift */; };
F8D1C6F519D52968002E74FE /* ManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8D1C6F419D52968002E74FE /* ManagerTests.swift */; };
F8D1C6F519D52968002E74FE /* SessionManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8D1C6F419D52968002E74FE /* SessionManagerTests.swift */; };
F8E6024519CB46A800A3E7F1 /* AuthenticationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8E6024419CB46A800A3E7F1 /* AuthenticationTests.swift */; };
/* End PBXBuildFile section */
......@@ -293,7 +293,7 @@
4CCB206A1D4549E000C64D5B /* expired.badssl.com-intermediate-ca-1.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = "expired.badssl.com-intermediate-ca-1.cer"; sourceTree = "<group>"; };
4CCB206B1D4549E000C64D5B /* expired.badssl.com-intermediate-ca-2.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = "expired.badssl.com-intermediate-ca-2.cer"; sourceTree = "<group>"; };
4CCFA7991B2BE71600B6F460 /* URLProtocolTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = URLProtocolTests.swift; sourceTree = "<group>"; };
4CDE2C361AF8932A00BABAE5 /* Manager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Manager.swift; sourceTree = "<group>"; };
4CDE2C361AF8932A00BABAE5 /* SessionManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SessionManager.swift; sourceTree = "<group>"; };
4CDE2C391AF899EC00BABAE5 /* Request.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Request.swift; sourceTree = "<group>"; };
4CDE2C3C1AF89D4900BABAE5 /* Download.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Download.swift; sourceTree = "<group>"; };
4CDE2C3F1AF89E0700BABAE5 /* Upload.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Upload.swift; sourceTree = "<group>"; };
......@@ -326,7 +326,7 @@
F86AEFE51AE6A282007D9C76 /* TLSEvaluationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TLSEvaluationTests.swift; sourceTree = "<group>"; };
F897FF4019AA800700AB5182 /* Alamofire.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Alamofire.swift; sourceTree = "<group>"; };
F8AE910119D28DCC0078C7B2 /* ValidationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValidationTests.swift; sourceTree = "<group>"; };
F8D1C6F419D52968002E74FE /* ManagerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ManagerTests.swift; sourceTree = "<group>"; };
F8D1C6F419D52968002E74FE /* SessionManagerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SessionManagerTests.swift; sourceTree = "<group>"; };
F8E6024419CB46A800A3E7F1 /* AuthenticationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthenticationTests.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -390,12 +390,12 @@
isa = PBXGroup;
children = (
F8E6024419CB46A800A3E7F1 /* AuthenticationTests.swift */,
F8D1C6F419D52968002E74FE /* ManagerTests.swift */,
F8111E5C19A9674D0040E7D1 /* ParameterEncodingTests.swift */,
F8111E5D19A9674D0040E7D1 /* RequestTests.swift */,
F8111E5E19A9674D0040E7D1 /* ResponseTests.swift */,
4CA028C41B7466C500C84163 /* ResultTests.swift */,
4C9DCE771CB1BCE2003E6463 /* SessionDelegateTests.swift */,
F8D1C6F419D52968002E74FE /* SessionManagerTests.swift */,
);
name = Core;
sourceTree = "<group>";
......@@ -529,12 +529,12 @@
isa = PBXGroup;
children = (
4C1DC8531B68908E00476DE3 /* Error.swift */,
4CDE2C361AF8932A00BABAE5 /* Manager.swift */,
4CB928281C66BFBC00CE5F08 /* Notifications.swift */,
4CE2724E1AF88FB500F1D59A /* ParameterEncoding.swift */,
4CDE2C391AF899EC00BABAE5 /* Request.swift */,
4C0B62501BB1001C009302D3 /* Response.swift */,
4C0E5BF71B673D3400816CCC /* Result.swift */,
4CDE2C361AF8932A00BABAE5 /* SessionManager.swift */,
);
name = Core;
sourceTree = "<group>";
......@@ -1019,7 +1019,7 @@
4CF6270E1BA7CBF60011A099 /* MultipartFormData.swift in Sources */,
4C80F9F81BB730EF001B46D2 /* Response.swift in Sources */,
4CB9282B1C66BFBC00CE5F08 /* Notifications.swift in Sources */,
4CF627091BA7CBF60011A099 /* Manager.swift in Sources */,
4CF627091BA7CBF60011A099 /* SessionManager.swift in Sources */,
4CF6270F1BA7CBF60011A099 /* ResponseSerialization.swift in Sources */,
4CF6270B1BA7CBF60011A099 /* Request.swift in Sources */,
4C3D00561C66A63000D1F709 /* NetworkReachabilityManager.swift in Sources */,
......@@ -1048,7 +1048,7 @@
4CF627191BA7CC240011A099 /* ResponseTests.swift in Sources */,
4CF627231BA7CC240011A099 /* URLProtocolTests.swift in Sources */,
4CF6271C1BA7CC240011A099 /* CacheTests.swift in Sources */,
4CF627161BA7CC240011A099 /* ManagerTests.swift in Sources */,
4CF627161BA7CC240011A099 /* SessionManagerTests.swift in Sources */,
4CF6271A1BA7CC240011A099 /* ResultTests.swift in Sources */,
4C3D005A1C66A8B900D1F709 /* NetworkReachabilityManagerTests.swift in Sources */,
4CF6271F1BA7CC240011A099 /* ResponseSerializationTests.swift in Sources */,
......@@ -1066,7 +1066,7 @@
4CDE2C3B1AF899EC00BABAE5 /* Request.swift in Sources */,
4CDE2C471AF89FF300BABAE5 /* ResponseSerialization.swift in Sources */,
4C1DC8551B68908E00476DE3 /* Error.swift in Sources */,
4CDE2C381AF8932A00BABAE5 /* Manager.swift in Sources */,
4CDE2C381AF8932A00BABAE5 /* SessionManager.swift in Sources */,
4C0B62521BB1001C009302D3 /* Response.swift in Sources */,
4CB9282A1C66BFBC00CE5F08 /* Notifications.swift in Sources */,
4DD67C251A5C590000ED2280 /* Alamofire.swift in Sources */,
......@@ -1091,7 +1091,7 @@
E4202FD11B667AA100C997FB /* Request.swift in Sources */,
4CEC605A1B745C9100E684F4 /* Error.swift in Sources */,
E4202FD21B667AA100C997FB /* ResponseSerialization.swift in Sources */,
E4202FD31B667AA100C997FB /* Manager.swift in Sources */,
E4202FD31B667AA100C997FB /* SessionManager.swift in Sources */,
4C0B62531BB1001C009302D3 /* Response.swift in Sources */,
4CB9282C1C66BFBC00CE5F08 /* Notifications.swift in Sources */,
4CEC605B1B745C9100E684F4 /* Result.swift in Sources */,
......@@ -1114,7 +1114,7 @@
4CDE2C3A1AF899EC00BABAE5 /* Request.swift in Sources */,
4CDE2C461AF89FF300BABAE5 /* ResponseSerialization.swift in Sources */,
4C1DC8541B68908E00476DE3 /* Error.swift in Sources */,
4CDE2C371AF8932A00BABAE5 /* Manager.swift in Sources */,
4CDE2C371AF8932A00BABAE5 /* SessionManager.swift in Sources */,
4C0B62511BB1001C009302D3 /* Response.swift in Sources */,
F897FF4119AA800700AB5182 /* Alamofire.swift in Sources */,
4C23EB431B327C5B0090E0BC /* MultipartFormData.swift in Sources */,
......@@ -1145,7 +1145,7 @@
4C256A531B096C770065714F /* BaseTestCase.swift in Sources */,
F8E6024519CB46A800A3E7F1 /* AuthenticationTests.swift in Sources */,
F8858DDE19A96B4400F55F93 /* ResponseTests.swift in Sources */,
F8D1C6F519D52968002E74FE /* ManagerTests.swift in Sources */,
F8D1C6F519D52968002E74FE /* SessionManagerTests.swift in Sources */,
F8AE910219D28DCC0078C7B2 /* ValidationTests.swift in Sources */,
F8111E6119A9674D0040E7D1 /* ParameterEncodingTests.swift in Sources */,
F8111E6419A9674D0040E7D1 /* UploadTests.swift in Sources */,
......@@ -1169,7 +1169,7 @@
4C0B583A1B747A4400C0B99C /* ResponseSerializationTests.swift in Sources */,
F829C6BF1A7A950600A2CD59 /* RequestTests.swift in Sources */,
4C256A541B096C770065714F /* BaseTestCase.swift in Sources */,
F829C6C01A7A950600A2CD59 /* ManagerTests.swift in Sources */,
F829C6C01A7A950600A2CD59 /* SessionManagerTests.swift in Sources */,
F829C6C11A7A950600A2CD59 /* ResponseTests.swift in Sources */,
F829C6C21A7A950600A2CD59 /* UploadTests.swift in Sources */,
F829C6C31A7A950600A2CD59 /* DownloadTests.swift in Sources */,
......
......@@ -94,7 +94,7 @@ extension URLRequest {
// MARK: - Request Methods
/**
Creates a request using the shared manager instance for the specified method, URL string, parameters, and
Creates a request using the shared session manager instance for the specified method, URL string, parameters, and
parameter encoding.
- parameter method: The HTTP method.
......@@ -114,7 +114,7 @@ public func request(
headers: [String: String]? = nil)
-> Request
{
return Manager.sharedInstance.request(
return SessionManager.sharedInstance.request(
method,
URLString,
parameters: parameters,
......@@ -124,7 +124,7 @@ public func request(
}
/**
Creates a request using the shared manager instance for the specified URL request.
Creates a request using the shared session manager instance for the specified URL request.
If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
......@@ -134,7 +134,7 @@ public func request(
*/
@discardableResult
public func request(_ urlRequest: URLRequestConvertible) -> Request {
return Manager.sharedInstance.request(urlRequest.urlRequest)
return SessionManager.sharedInstance.request(urlRequest.urlRequest)
}
// MARK: - Upload Methods
......@@ -142,7 +142,7 @@ public func request(_ urlRequest: URLRequestConvertible) -> Request {
// MARK: File
/**
Creates an upload request using the shared manager instance for the specified method, URL string, and file.
Creates an upload request using the shared session manager instance for the specified method, URL string, and file.
- parameter method: The HTTP method.
- parameter URLString: The URL string.
......@@ -159,11 +159,11 @@ public func upload(
file: URL)
-> Request
{
return Manager.sharedInstance.upload(method, URLString, headers: headers, file: file)
return SessionManager.sharedInstance.upload(method, URLString, headers: headers, file: file)
}
/**
Creates an upload request using the shared manager instance for the specified URL request and file.
Creates an upload request using the shared session manager instance for the specified URL request and file.
- parameter URLRequest: The URL request.
- parameter file: The file to upload.
......@@ -172,13 +172,13 @@ public func upload(
*/
@discardableResult
public func upload(_ URLRequest: URLRequestConvertible, file: URL) -> Request {
return Manager.sharedInstance.upload(URLRequest, file: file)
return SessionManager.sharedInstance.upload(URLRequest, file: file)
}
// MARK: Data
/**
Creates an upload request using the shared manager instance for the specified method, URL string, and data.
Creates an upload request using the shared session manager instance for the specified method, URL string, and data.
- parameter method: The HTTP method.
- parameter URLString: The URL string.
......@@ -195,11 +195,11 @@ public func upload(
data: Data)
-> Request
{
return Manager.sharedInstance.upload(method, URLString, headers: headers, data: data)
return SessionManager.sharedInstance.upload(method, URLString, headers: headers, data: data)
}
/**
Creates an upload request using the shared manager instance for the specified URL request and data.
Creates an upload request using the shared session manager instance for the specified URL request and data.
- parameter URLRequest: The URL request.
- parameter data: The data to upload.
......@@ -208,13 +208,13 @@ public func upload(
*/
@discardableResult
public func upload(_ URLRequest: URLRequestConvertible, data: Data) -> Request {
return Manager.sharedInstance.upload(URLRequest, data: data)
return SessionManager.sharedInstance.upload(URLRequest, data: data)
}
// MARK: Stream
/**
Creates an upload request using the shared manager instance for the specified method, URL string, and stream.
Creates an upload request using the shared session manager instance for the specified method, URL string, and stream.
- parameter method: The HTTP method.
- parameter URLString: The URL string.
......@@ -231,11 +231,11 @@ public func upload(
stream: InputStream)
-> Request
{
return Manager.sharedInstance.upload(method, URLString, headers: headers, stream: stream)
return SessionManager.sharedInstance.upload(method, URLString, headers: headers, stream: stream)
}
/**
Creates an upload request using the shared manager instance for the specified URL request and stream.
Creates an upload request using the shared session manager instance for the specified URL request and stream.
- parameter URLRequest: The URL request.
- parameter stream: The stream to upload.
......@@ -244,13 +244,13 @@ public func upload(
*/
@discardableResult
public func upload(_ URLRequest: URLRequestConvertible, stream: InputStream) -> Request {
return Manager.sharedInstance.upload(urlRequest: URLRequest, stream: stream)
return SessionManager.sharedInstance.upload(urlRequest: URLRequest, stream: stream)
}
// MARK: MultipartFormData
/**
Creates an upload request using the shared manager instance for the specified method and URL string.
Creates an upload request using the shared session manager instance for the specified method and URL string.
- parameter method: The HTTP method.
- parameter URLString: The URL string.
......@@ -265,10 +265,10 @@ public func upload(
_ URLString: URLStringConvertible,
headers: [String: String]? = nil,
multipartFormData: (MultipartFormData) -> Void,
encodingMemoryThreshold: UInt64 = Manager.MultipartFormDataEncodingMemoryThreshold,
encodingCompletion: ((Manager.MultipartFormDataEncodingResult) -> Void)?)
encodingMemoryThreshold: UInt64 = SessionManager.MultipartFormDataEncodingMemoryThreshold,
encodingCompletion: ((SessionManager.MultipartFormDataEncodingResult) -> Void)?)
{
return Manager.sharedInstance.upload(
return SessionManager.sharedInstance.upload(
method,
URLString,
headers: headers,
......@@ -279,7 +279,7 @@ public func upload(
}
/**
Creates an upload request using the shared manager instance for the specified method and URL string.
Creates an upload request using the shared session manager instance for the specified method and URL string.
- parameter URLRequest: The URL request.
- parameter multipartFormData: The closure used to append body parts to the `MultipartFormData`.
......@@ -290,10 +290,10 @@ public func upload(
public func upload(
_ URLRequest: URLRequestConvertible,
multipartFormData: (MultipartFormData) -> Void,
encodingMemoryThreshold: UInt64 = Manager.MultipartFormDataEncodingMemoryThreshold,
encodingCompletion: ((Manager.MultipartFormDataEncodingResult) -> Void)?)
encodingMemoryThreshold: UInt64 = SessionManager.MultipartFormDataEncodingMemoryThreshold,
encodingCompletion: ((SessionManager.MultipartFormDataEncodingResult) -> Void)?)
{
return Manager.sharedInstance.upload(
return SessionManager.sharedInstance.upload(
URLRequest,
multipartFormData: multipartFormData,
encodingMemoryThreshold: encodingMemoryThreshold,
......@@ -306,7 +306,7 @@ public func upload(
// MARK: URL Request
/**
Creates a download request using the shared manager instance for the specified method and URL string.
Creates a download request using the shared session manager instance for the specified method and URL string.
- parameter method: The HTTP method.
- parameter URLString: The URL string.
......@@ -327,7 +327,7 @@ public func download(
destination: Request.DownloadFileDestination)
-> Request
{
return Manager.sharedInstance.download(
return SessionManager.sharedInstance.download(
method,
URLString,
parameters: parameters,
......@@ -338,7 +338,7 @@ public func download(
}
/**
Creates a download request using the shared manager instance for the specified URL request.
Creates a download request using the shared session manager instance for the specified URL request.
- parameter URLRequest: The URL request.
- parameter destination: The closure used to determine the destination of the downloaded file.
......@@ -347,13 +347,13 @@ public func download(
*/
@discardableResult
public func download(_ URLRequest: URLRequestConvertible, destination: Request.DownloadFileDestination) -> Request {
return Manager.sharedInstance.download(URLRequest, destination: destination)
return SessionManager.sharedInstance.download(URLRequest, destination: destination)
}
// MARK: Resume Data
/**
Creates a request using the shared manager instance for downloading from the resume data produced from a
Creates a request using the shared session manager instance for downloading from the resume data produced from a
previous request cancellation.
- parameter resumeData: The resume data. This is an opaque data blob produced by `NSURLSessionDownloadTask`
......@@ -365,5 +365,5 @@ public func download(_ URLRequest: URLRequestConvertible, destination: Request.D
*/
@discardableResult
public func download(resumeData data: Data, destination: Request.DownloadFileDestination) -> Request {
return Manager.sharedInstance.download(data, destination: destination)
return SessionManager.sharedInstance.download(data, destination: destination)
}
......@@ -24,7 +24,7 @@
import Foundation
extension Manager {
extension SessionManager {
private enum Downloadable {
case request(Foundation.URLRequest)
case resumeData(Data)
......
//
// Manager.swift
// SessionManager.swift
//
// Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/)
//
......@@ -27,19 +27,19 @@ import Foundation
/**
Responsible for creating and managing `Request` objects, as well as their underlying `NSURLSession`.
*/
public class Manager {
public class SessionManager {
// MARK: - Properties
/**
A shared instance of `Manager`, used by top-level Alamofire request methods, and suitable for use directly
for any ad hoc requests.
A shared instance of `SessionManager`, used by top-level Alamofire request methods, and suitable for use
directly for any ad hoc requests.
*/
public static let sharedInstance: Manager = {
public static let sharedInstance: SessionManager = {
let configuration = URLSessionConfiguration.default
configuration.httpAdditionalHeaders = Manager.defaultHTTPHeaders
configuration.httpAdditionalHeaders = SessionManager.defaultHTTPHeaders
return Manager(configuration: configuration)
return SessionManager(configuration: configuration)
}()
/**
......@@ -98,7 +98,7 @@ public class Manager {
]
}()
let queue = DispatchQueue(label: "Alamofire Manager Queue")
let queue = DispatchQueue(label: "Alamofire Session Manager Queue")
/// The underlying session.
public let session: URLSession
......
......@@ -27,7 +27,7 @@ import Foundation
#if !os(watchOS)
@available(iOS 9.0, OSX 10.11, tvOS 9.0, *)
extension Manager {
extension SessionManager {
private enum Streamable {
case stream(String, Int)
case netService(Foundation.NetService)
......@@ -85,7 +85,7 @@ extension Manager {
// MARK: -
@available(iOS 9.0, OSX 10.11, tvOS 9.0, *)
extension Manager.SessionDelegate: URLSessionStreamDelegate {
extension SessionManager.SessionDelegate: URLSessionStreamDelegate {
// MARK: Override Closures
......
......@@ -24,7 +24,7 @@
import Foundation
extension Manager {
extension SessionManager {
private enum Uploadable {
case data(Foundation.URLRequest, Foundation.Data)
case file(Foundation.URLRequest, URL)
......@@ -238,7 +238,7 @@ extension Manager {
_ URLString: URLStringConvertible,
headers: [String: String]? = nil,
multipartFormData: (MultipartFormData) -> Void,
encodingMemoryThreshold: UInt64 = Manager.MultipartFormDataEncodingMemoryThreshold,
encodingMemoryThreshold: UInt64 = SessionManager.MultipartFormDataEncodingMemoryThreshold,
encodingCompletion: ((MultipartFormDataEncodingResult) -> Void)?)
{
let mutableURLRequest = URLRequest(method, URLString, headers: headers)
......@@ -278,7 +278,7 @@ extension Manager {
public func upload(
_ urlRequest: URLRequestConvertible,
multipartFormData: (MultipartFormData) -> Void,
encodingMemoryThreshold: UInt64 = Manager.MultipartFormDataEncodingMemoryThreshold,
encodingMemoryThreshold: UInt64 = SessionManager.MultipartFormDataEncodingMemoryThreshold,
encodingCompletion: ((MultipartFormDataEncodingResult) -> Void)?)
{
DispatchQueue.global(qos: .utility).async {
......
......@@ -31,12 +31,12 @@ class AuthenticationTestCase: BaseTestCase {
let password = "password"
var URLString = ""
var manager: Manager!
var manager: SessionManager!
override func setUp() {
super.setUp()
manager = Manager(configuration: .default)
manager = SessionManager(configuration: .default)
// Clear out credentials
let credentialStorage = URLCredentialStorage.shared
......
......@@ -72,8 +72,8 @@ class CacheTestCase: BaseTestCase {
// MARK: - Properties
var URLCache: Foundation.URLCache!
var manager: Manager!
var urlCache: URLCache!
var manager: SessionManager!
let URLString = "https://httpbin.org/response-headers"
let requestTimeout: TimeInterval = 30
......@@ -86,24 +86,24 @@ class CacheTestCase: BaseTestCase {
override func setUp() {
super.setUp()
URLCache = {
urlCache = {
let capacity = 50 * 1024 * 1024 // MBs
let URLCache = Foundation.URLCache(memoryCapacity: capacity, diskCapacity: capacity, diskPath: nil)
let urlCache = Foundation.URLCache(memoryCapacity: capacity, diskCapacity: capacity, diskPath: nil)
return URLCache
return urlCache
}()
manager = {
let configuration: URLSessionConfiguration = {
let configuration = URLSessionConfiguration.default
configuration.httpAdditionalHeaders = Alamofire.Manager.defaultHTTPHeaders
configuration.httpAdditionalHeaders = SessionManager.defaultHTTPHeaders
configuration.requestCachePolicy = .useProtocolCachePolicy
configuration.urlCache = URLCache
configuration.urlCache = urlCache
return configuration
}()
let manager = Manager(configuration: configuration)
let manager = SessionManager(configuration: configuration)
return manager
}()
......@@ -117,7 +117,7 @@ class CacheTestCase: BaseTestCase {
requests.removeAll()
timestamps.removeAll()
URLCache.removeAllCachedResponses()
urlCache.removeAllCachedResponses()
}
// MARK: - Cache Priming Methods
......@@ -250,12 +250,12 @@ class CacheTestCase: BaseTestCase {
let noStoreRequest = requests[CacheControl.NoStore]!
// When
let publicResponse = URLCache.cachedResponse(for: publicRequest)
let privateResponse = URLCache.cachedResponse(for: privateRequest)
let maxAgeNonExpiredResponse = URLCache.cachedResponse(for: maxAgeNonExpiredRequest)
let maxAgeExpiredResponse = URLCache.cachedResponse(for: maxAgeExpiredRequest)
let noCacheResponse = URLCache.cachedResponse(for: noCacheRequest)
let noStoreResponse = URLCache.cachedResponse(for: noStoreRequest)
let publicResponse = urlCache.cachedResponse(for: publicRequest)
let privateResponse = urlCache.cachedResponse(for: privateRequest)
let maxAgeNonExpiredResponse = urlCache.cachedResponse(for: maxAgeNonExpiredRequest)
let maxAgeExpiredResponse = urlCache.cachedResponse(for: maxAgeExpiredRequest)
let noCacheResponse = urlCache.cachedResponse(for: noCacheRequest)
let noStoreResponse = urlCache.cachedResponse(for: noStoreRequest)
// Then
XCTAssertNotNil(publicResponse, "\(CacheControl.Public) response should not be nil")
......
......@@ -477,41 +477,41 @@ class RequestDescriptionTestCase: BaseTestCase {
class RequestDebugDescriptionTestCase: BaseTestCase {
// MARK: Properties
let manager: Manager = {
let manager = Manager(configuration: .default)
let manager: SessionManager = {
let manager = SessionManager(configuration: .default)
manager.startRequestsImmediately = false
return manager
}()
let managerWithAcceptLanguageHeader: Manager = {
var headers = Alamofire.Manager.sharedInstance.session.configuration.httpAdditionalHeaders ?? [:]
let managerWithAcceptLanguageHeader: SessionManager = {
var headers = SessionManager.sharedInstance.session.configuration.httpAdditionalHeaders ?? [:]
headers["Accept-Language"] = "en-US"
let configuration = URLSessionConfiguration.default
configuration.httpAdditionalHeaders = headers
let manager = Manager(configuration: configuration)
let manager = SessionManager(configuration: configuration)
manager.startRequestsImmediately = false
return manager
}()
let managerWithContentTypeHeader: Manager = {
var headers = Alamofire.Manager.sharedInstance.session.configuration.httpAdditionalHeaders ?? [:]
let managerWithContentTypeHeader: SessionManager = {
var headers = SessionManager.sharedInstance.session.configuration.httpAdditionalHeaders ?? [:]
headers["Content-Type"] = "application/json"
let configuration = URLSessionConfiguration.default
configuration.httpAdditionalHeaders = headers
let manager = Manager(configuration: configuration)
let manager = SessionManager(configuration: configuration)
manager.startRequestsImmediately = false
return manager
}()
let managerDisallowingCookies: Manager = {
let managerDisallowingCookies: SessionManager = {
let configuration = URLSessionConfiguration.default
configuration.httpShouldSetCookies = false
let manager = Manager(configuration: configuration)
let manager = SessionManager(configuration: configuration)
manager.startRequestsImmediately = false
return manager
......
......@@ -27,13 +27,13 @@ import Foundation
import XCTest
class SessionDelegateTestCase: BaseTestCase {
var manager: Alamofire.Manager!
var manager: SessionManager!
// MARK: - Setup and Teardown
override func setUp() {
super.setUp()
manager = Alamofire.Manager(configuration: .ephemeral)
manager = SessionManager(configuration: .ephemeral)
}
// MARK: - Tests - Session Invalidation
......@@ -191,7 +191,7 @@ class SessionDelegateTestCase: BaseTestCase {
let expectation = self.expectation(description: "Request should redirect to \(redirectURLString)")
let callbackExpectation = self.expectation(description: "Redirect callback should be made")
let delegate: Alamofire.Manager.SessionDelegate = manager.delegate
let delegate: SessionManager.SessionDelegate = manager.delegate
delegate.taskWillPerformHTTPRedirection = { _, _, _, request in
callbackExpectation.fulfill()
......@@ -232,7 +232,7 @@ class SessionDelegateTestCase: BaseTestCase {
let expectation = self.expectation(description: "Request should redirect to \(redirectURLString)")
let callbackExpectation = self.expectation(description: "Redirect callback should be made")
let delegate: Alamofire.Manager.SessionDelegate = manager.delegate
let delegate: SessionManager.SessionDelegate = manager.delegate
delegate.taskWillPerformHTTPRedirectionWithCompletion = { _, _, _, request, completion in
completion(request)
......@@ -274,7 +274,7 @@ class SessionDelegateTestCase: BaseTestCase {
let expectation = self.expectation(description: "Request should not redirect to \(redirectURLString)")
let callbackExpectation = self.expectation(description: "Redirect callback should be made")
let delegate: Alamofire.Manager.SessionDelegate = manager.delegate
let delegate: SessionManager.SessionDelegate = manager.delegate
delegate.taskWillPerformHTTPRedirectionWithCompletion = { _, _, _, _, completion in
callbackExpectation.fulfill()
......@@ -316,7 +316,7 @@ class SessionDelegateTestCase: BaseTestCase {
let expectation = self.expectation(description: "Request should not redirect to \(redirectURLString)")
let callbackExpectation = self.expectation(description: "Redirect callback should be made")
let delegate: Alamofire.Manager.SessionDelegate = manager.delegate
let delegate: SessionManager.SessionDelegate = manager.delegate
delegate.taskWillPerformHTTPRedirection = { _, _, _, _ in
callbackExpectation.fulfill()
......@@ -358,7 +358,7 @@ class SessionDelegateTestCase: BaseTestCase {
let URLString = "https://httpbin.org/redirect/\(redirectCount)"
let expectation = self.expectation(description: "Request should redirect to \(redirectURLString)")
let delegate: Alamofire.Manager.SessionDelegate = manager.delegate
let delegate: SessionManager.SessionDelegate = manager.delegate
var redirectExpectations = [XCTestExpectation]()
for index in 0..<redirectCount {
redirectExpectations.insert(self.expectation(description: "Redirect #\(index) callback was received"), at: 0)
......@@ -409,7 +409,7 @@ class SessionDelegateTestCase: BaseTestCase {
let URLString = "https://httpbin.org/redirect/\(redirectCount)"
let expectation = self.expectation(description: "Request should redirect to \(redirectURLString)")
let delegate: Alamofire.Manager.SessionDelegate = manager.delegate
let delegate: SessionManager.SessionDelegate = manager.delegate
var redirectExpectations = [XCTestExpectation]()
......
//
// ManagerTests.swift
// SessionManagerTests.swift
//
// Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/)
//
......@@ -26,13 +26,13 @@
import Foundation
import XCTest
class ManagerTestCase: BaseTestCase {
class SessionManagerTestCase: BaseTestCase {
// MARK: Initialization Tests
func testInitializerWithDefaultArguments() {
// Given, When
let manager = Manager()
let manager = SessionManager()
// Then
XCTAssertNotNil(manager.session.delegate, "session delegate should not be nil")
......@@ -43,11 +43,11 @@ class ManagerTestCase: BaseTestCase {
func testInitializerWithSpecifiedArguments() {
// Given
let configuration = URLSessionConfiguration.default
let delegate = Manager.SessionDelegate()
let delegate = SessionManager.SessionDelegate()
let serverTrustPolicyManager = ServerTrustPolicyManager(policies: [:])
// When
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
delegate: delegate,
serverTrustPolicyManager: serverTrustPolicyManager
......@@ -61,14 +61,14 @@ class ManagerTestCase: BaseTestCase {
func testThatFailableInitializerSucceedsWithDefaultArguments() {
// Given
let delegate = Manager.SessionDelegate()
let delegate = SessionManager.SessionDelegate()
let session: URLSession = {
let configuration = URLSessionConfiguration.default
return URLSession(configuration: configuration, delegate: delegate, delegateQueue: nil)
}()
// When
let manager = Manager(session: session, delegate: delegate)
let manager = SessionManager(session: session, delegate: delegate)
// Then
if let manager = manager {
......@@ -81,7 +81,7 @@ class ManagerTestCase: BaseTestCase {
func testThatFailableInitializerSucceedsWithSpecifiedArguments() {
// Given
let delegate = Manager.SessionDelegate()
let delegate = SessionManager.SessionDelegate()
let session: URLSession = {
let configuration = URLSessionConfiguration.default
return URLSession(configuration: configuration, delegate: delegate, delegateQueue: nil)
......@@ -90,7 +90,7 @@ class ManagerTestCase: BaseTestCase {
let serverTrustPolicyManager = ServerTrustPolicyManager(policies: [:])
// When
let manager = Manager(session: session, delegate: delegate, serverTrustPolicyManager: serverTrustPolicyManager)
let manager = SessionManager(session: session, delegate: delegate, serverTrustPolicyManager: serverTrustPolicyManager)
// Then
if let manager = manager {
......@@ -103,14 +103,14 @@ class ManagerTestCase: BaseTestCase {
func testThatFailableInitializerFailsWithWhenDelegateDoesNotEqualSessionDelegate() {
// Given
let delegate = Manager.SessionDelegate()
let delegate = SessionManager.SessionDelegate()
let session: URLSession = {
let configuration = URLSessionConfiguration.default
return URLSession(configuration: configuration, delegate: Manager.SessionDelegate(), delegateQueue: nil)
return URLSession(configuration: configuration, delegate: SessionManager.SessionDelegate(), delegateQueue: nil)
}()
// When
let manager = Manager(session: session, delegate: delegate)
let manager = SessionManager(session: session, delegate: delegate)
// Then
XCTAssertNil(manager, "manager should be nil")
......@@ -118,14 +118,14 @@ class ManagerTestCase: BaseTestCase {
func testThatFailableInitializerFailsWhenSessionDelegateIsNil() {
// Given
let delegate = Manager.SessionDelegate()
let delegate = SessionManager.SessionDelegate()
let session: URLSession = {
let configuration = URLSessionConfiguration.default
return URLSession(configuration: configuration, delegate: nil, delegateQueue: nil)
}()
// When
let manager = Manager(session: session, delegate: delegate)
let manager = SessionManager(session: session, delegate: delegate)
// Then
XCTAssertNil(manager, "manager should be nil")
......@@ -135,7 +135,7 @@ class ManagerTestCase: BaseTestCase {
func testSetStartRequestsImmediatelyToFalseAndResumeRequest() {
// Given
let manager = Alamofire.Manager()
let manager = SessionManager()
manager.startRequestsImmediately = false
let URL = Foundation.URL(string: "https://httpbin.org/get")!
......@@ -164,7 +164,7 @@ class ManagerTestCase: BaseTestCase {
func testReleasingManagerWithPendingRequestDeinitializesSuccessfully() {
// Given
var manager: Manager? = Alamofire.Manager()
var manager: SessionManager? = SessionManager()
manager?.startRequestsImmediately = false
let URL = Foundation.URL(string: "https://httpbin.org/get")!
......@@ -181,7 +181,7 @@ class ManagerTestCase: BaseTestCase {
func testReleasingManagerWithPendingCanceledRequestDeinitializesSuccessfully() {
// Given
var manager: Manager? = Alamofire.Manager()
var manager: SessionManager? = SessionManager()
manager!.startRequestsImmediately = false
let URL = Foundation.URL(string: "https://httpbin.org/get")!
......@@ -224,7 +224,7 @@ class ManagerConfigurationHeadersTestCase: BaseTestCase {
private func executeAuthorizationHeaderTestForConfigurationType(_ type: ConfigurationType) {
// Given
let manager: Manager = {
let manager: SessionManager = {
let configuration: URLSessionConfiguration = {
let configuration: URLSessionConfiguration
......@@ -238,14 +238,14 @@ class ManagerConfigurationHeadersTestCase: BaseTestCase {
configuration = .background(withIdentifier: identifier)
}
var headers = Alamofire.Manager.defaultHTTPHeaders
var headers = SessionManager.defaultHTTPHeaders
headers["Authorization"] = "Bearer 123456"
configuration.httpAdditionalHeaders = headers
return configuration
}()
return Manager(configuration: configuration)
return SessionManager(configuration: configuration)
}()
let expectation = self.expectation(description: "request should complete successfully")
......
......@@ -80,7 +80,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
func testThatExpiredCertificateRequestFailsWithNoServerTrustPolicy() {
// Given
weak var expectation = self.expectation(description: "\(URL)")
let manager = Manager(configuration: configuration)
let manager = SessionManager(configuration: configuration)
var error: NSError?
// When
......@@ -107,7 +107,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
func testThatExpiredCertificateRequestFailsWithDefaultServerTrustPolicy() {
// Given
let policies = [host: ServerTrustPolicy.performDefaultEvaluation(validateHost: true)]
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: policies)
)
......@@ -143,7 +143,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
host: .pinCertificates(certificates: certificates, validateCertificateChain: true, validateHost: true)
]
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: policies)
)
......@@ -183,7 +183,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
host: .pinCertificates(certificates: certificates, validateCertificateChain: true, validateHost: true)
]
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: policies)
)
......@@ -217,7 +217,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
host: .pinCertificates(certificates: certificates, validateCertificateChain: false, validateHost: true)
]
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: policies)
)
......@@ -245,7 +245,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
host: .pinCertificates(certificates: certificates, validateCertificateChain: false, validateHost: true)
]
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: policies)
)
......@@ -273,7 +273,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
host: .pinCertificates(certificates: certificates, validateCertificateChain: false, validateHost: true)
]
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: policies)
)
......@@ -303,7 +303,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
host: .pinPublicKeys(publicKeys: publicKeys, validateCertificateChain: true, validateHost: true)
]
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: policies)
)
......@@ -337,7 +337,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
host: .pinPublicKeys(publicKeys: publicKeys, validateCertificateChain: false, validateHost: true)
]
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: policies)
)
......@@ -365,7 +365,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
host: .pinPublicKeys(publicKeys: publicKeys, validateCertificateChain: false, validateHost: true)
]
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: policies)
)
......@@ -393,7 +393,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
host: .pinPublicKeys(publicKeys: publicKeys, validateCertificateChain: false, validateHost: true)
]
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: policies)
)
......@@ -419,7 +419,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
func testThatExpiredCertificateRequestSucceedsWhenDisablingEvaluation() {
// Given
let policies = [host: ServerTrustPolicy.disableEvaluation]
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: policies)
)
......@@ -451,7 +451,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
}
]
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: policies)
)
......@@ -481,7 +481,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
}
]
let manager = Manager(
let manager = SessionManager(
configuration: configuration,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: policies)
)
......
......@@ -34,10 +34,10 @@ class ProxyURLProtocol: URLProtocol {
static let HandledByForwarderURLProtocol = "HandledByProxyURLProtocol"
}
lazy var session: Foundation.URLSession = {
lazy var session: URLSession = {
let configuration: URLSessionConfiguration = {
let configuration = URLSessionConfiguration.ephemeral
configuration.httpAdditionalHeaders = Alamofire.Manager.defaultHTTPHeaders
configuration.httpAdditionalHeaders = SessionManager.defaultHTTPHeaders
return configuration
}()
......@@ -110,7 +110,7 @@ extension ProxyURLProtocol: URLSessionDelegate {
// MARK: -
class URLProtocolTestCase: BaseTestCase {
var manager: Manager!
var manager: SessionManager!
// MARK: Setup and Teardown
......@@ -126,7 +126,7 @@ class URLProtocolTestCase: BaseTestCase {
return configuration
}()
return Manager(configuration: configuration)
return SessionManager(configuration: configuration)
}()
}
......
......@@ -237,7 +237,7 @@ class ContentTypeValidationTestCase: BaseTestCase {
func testThatValidationForRequestWithAcceptableWildcardContentTypeResponseSucceedsWhenResponseIsNil() {
// Given
class MockManager: Manager {
class MockManager: SessionManager {
override func request(_ urlRequest: URLRequestConvertible) -> Request {
var dataTask: URLSessionDataTask!
......@@ -271,10 +271,10 @@ class ContentTypeValidationTestCase: BaseTestCase {
override var mimeType: String? { return nil }
}
let manager: Manager = {
let manager: SessionManager = {
let configuration: URLSessionConfiguration = {
let configuration = URLSessionConfiguration.ephemeral
configuration.httpAdditionalHeaders = Alamofire.Manager.defaultHTTPHeaders
configuration.httpAdditionalHeaders = SessionManager.defaultHTTPHeaders
return configuration
}()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册