Bläddra i källkod

Removed excess whitespace from Swift files using Cleanup Whitespace target.

# Conflicts:
#	Source/ResponseSerialization.swift
#	Tests/MultipartFormDataTests.swift
#	Tests/ParameterEncodingTests.swift
#	Tests/RequestTests.swift
#	Tests/SessionDelegateTests.swift
Christian Noon 9 år sedan
förälder
incheckning
607ad25ed1

+ 3 - 3
Source/Alamofire.swift

@@ -27,7 +27,7 @@ import Foundation
 // MARK: - URLStringConvertible
 
 /**
-    Types adopting the `URLStringConvertible` protocol can be used to construct URL strings, which are then used to 
+    Types adopting the `URLStringConvertible` protocol can be used to construct URL strings, which are then used to
     construct URL requests.
 */
 public protocol URLStringConvertible {
@@ -350,11 +350,11 @@ public func download(_ URLRequest: URLRequestConvertible, destination: Request.D
 // 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 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`
-                             when a task is cancelled. See `NSURLSession -downloadTaskWithResumeData:` for additional 
+                             when a task is cancelled. See `NSURLSession -downloadTaskWithResumeData:` for additional
                              information.
     - parameter destination: The closure used to determine the destination of the downloaded file.
 

+ 6 - 6
Source/Download.swift

@@ -114,8 +114,8 @@ extension Manager {
 
         If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
 
-        - parameter resumeData:  The resume data. This is an opaque data blob produced by `NSURLSessionDownloadTask` 
-                                 when a task is cancelled. See `NSURLSession -downloadTaskWithResumeData:` for 
+        - parameter resumeData:  The resume data. This is an opaque data blob produced by `NSURLSessionDownloadTask`
+                                 when a task is cancelled. See `NSURLSession -downloadTaskWithResumeData:` for
                                  additional information.
         - parameter destination: The closure used to determine the destination of the downloaded file.
 
@@ -130,14 +130,14 @@ extension Manager {
 
 extension Request {
     /**
-        A closure executed once a request has successfully completed in order to determine where to move the temporary 
-        file written to during the download process. The closure takes two arguments: the temporary file URL and the URL 
+        A closure executed once a request has successfully completed in order to determine where to move the temporary
+        file written to during the download process. The closure takes two arguments: the temporary file URL and the URL
         response, and returns a single argument: the file URL where the temporary file should be moved.
     */
     public typealias DownloadFileDestination = (URL, HTTPURLResponse) -> URL
 
     /**
-        Creates a download file destination closure which uses the default file manager to move the temporary file to a 
+        Creates a download file destination closure which uses the default file manager to move the temporary file to a
         file URL in the first available directory with the specified search path directory and search path domain mask.
 
         - parameter directory: The search path directory. `.DocumentDirectory` by default.
@@ -220,7 +220,7 @@ extension Request {
                     session,
                     downloadTask,
                     bytesWritten,
-                    totalBytesWritten, 
+                    totalBytesWritten,
                     totalBytesExpectedToWrite
                 )
             } else {

+ 31 - 31
Source/Manager.swift

@@ -32,7 +32,7 @@ public class Manager {
     // MARK: - Properties
 
     /**
-        A shared instance of `Manager`, used by top-level Alamofire request methods, and suitable for use directly 
+        A shared instance of `Manager`, used by top-level Alamofire request methods, and suitable for use directly
         for any ad hoc requests.
     */
     public static let sharedInstance: Manager = {
@@ -116,14 +116,14 @@ public class Manager {
     public var startRequestsImmediately: Bool = true
 
     /**
-        The background completion handler closure provided by the UIApplicationDelegate 
-        `application:handleEventsForBackgroundURLSession:completionHandler:` method. By setting the background 
-        completion handler, the SessionDelegate `sessionDidFinishEventsForBackgroundURLSession` closure implementation 
+        The background completion handler closure provided by the UIApplicationDelegate
+        `application:handleEventsForBackgroundURLSession:completionHandler:` method. By setting the background
+        completion handler, the SessionDelegate `sessionDidFinishEventsForBackgroundURLSession` closure implementation
         will automatically call the handler.
-    
-        If you need to handle your own events before the handler is called, then you need to override the 
+
+        If you need to handle your own events before the handler is called, then you need to override the
         SessionDelegate `sessionDidFinishEventsForBackgroundURLSession` and manually call the handler when finished.
-    
+
         `nil` by default.
     */
     public var backgroundCompletionHandler: (() -> Void)?
@@ -133,11 +133,11 @@ public class Manager {
     /**
         Initializes the `Manager` instance with the specified configuration, delegate and server trust policy.
 
-        - parameter configuration:            The configuration used to construct the managed session. 
+        - parameter configuration:            The configuration used to construct the managed session.
                                               `NSURLSessionConfiguration.defaultSessionConfiguration()` by default.
         - parameter delegate:                 The delegate used when initializing the session. `SessionDelegate()` by
                                               default.
-        - parameter serverTrustPolicyManager: The server trust policy manager to use for evaluating all server trust 
+        - parameter serverTrustPolicyManager: The server trust policy manager to use for evaluating all server trust
                                               challenges. `nil` by default.
 
         - returns: The new `Manager` instance.
@@ -363,14 +363,14 @@ public class Manager {
         /// Overrides default behavior for NSURLSessionTaskDelegate method `URLSession:task:didReceiveChallenge:completionHandler:`.
         public var taskDidReceiveChallenge: ((Foundation.URLSession, URLSessionTask, URLAuthenticationChallenge) -> (Foundation.URLSession.AuthChallengeDisposition, URLCredential?))?
 
-        /// Overrides all behavior for NSURLSessionTaskDelegate method `URLSession:task:didReceiveChallenge:completionHandler:` and 
+        /// Overrides all behavior for NSURLSessionTaskDelegate method `URLSession:task:didReceiveChallenge:completionHandler:` and
         /// requires the caller to call the `completionHandler`.
         public var taskDidReceiveChallengeWithCompletion: ((Foundation.URLSession, URLSessionTask, URLAuthenticationChallenge, (Foundation.URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -> Void)?
 
         /// Overrides default behavior for NSURLSessionTaskDelegate method `URLSession:session:task:needNewBodyStream:`.
         public var taskNeedNewBodyStream: ((Foundation.URLSession, URLSessionTask) -> InputStream?)?
 
-        /// Overrides all behavior for NSURLSessionTaskDelegate method `URLSession:session:task:needNewBodyStream:` and 
+        /// Overrides all behavior for NSURLSessionTaskDelegate method `URLSession:session:task:needNewBodyStream:` and
         /// requires the caller to call the `completionHandler`.
         public var taskNeedNewBodyStreamWithCompletion: ((Foundation.URLSession, URLSessionTask, (InputStream?) -> Void) -> Void)?
 
@@ -389,8 +389,8 @@ public class Manager {
             - parameter task:              The task whose request resulted in a redirect.
             - parameter response:          An object containing the server’s response to the original request.
             - parameter request:           A URL request object filled out with the new location.
-            - parameter completionHandler: A closure that your handler should call with either the value of the request 
-                                           parameter, a modified URL request object, or NULL to refuse the redirect and 
+            - parameter completionHandler: A closure that your handler should call with either the value of the request
+                                           parameter, a modified URL request object, or NULL to refuse the redirect and
                                            return the body of the redirect response.
         */
         public func urlSession(
@@ -527,7 +527,7 @@ public class Manager {
         /// Overrides default behavior for NSURLSessionDataDelegate method `URLSession:dataTask:didReceiveResponse:completionHandler:`.
         public var dataTaskDidReceiveResponse: ((Foundation.URLSession, URLSessionDataTask, URLResponse) -> Foundation.URLSession.ResponseDisposition)?
 
-        /// Overrides all behavior for NSURLSessionDataDelegate method `URLSession:dataTask:didReceiveResponse:completionHandler:` and 
+        /// Overrides all behavior for NSURLSessionDataDelegate method `URLSession:dataTask:didReceiveResponse:completionHandler:` and
         /// requires caller to call the `completionHandler`.
         public var dataTaskDidReceiveResponseWithCompletion: ((Foundation.URLSession, URLSessionDataTask, URLResponse, (Foundation.URLSession.ResponseDisposition) -> Void) -> Void)?
 
@@ -540,7 +540,7 @@ public class Manager {
         /// Overrides default behavior for NSURLSessionDataDelegate method `URLSession:dataTask:willCacheResponse:completionHandler:`.
         public var dataTaskWillCacheResponse: ((Foundation.URLSession, URLSessionDataTask, CachedURLResponse) -> CachedURLResponse?)?
 
-        /// Overrides all behavior for NSURLSessionDataDelegate method `URLSession:dataTask:willCacheResponse:completionHandler:` and 
+        /// Overrides all behavior for NSURLSessionDataDelegate method `URLSession:dataTask:willCacheResponse:completionHandler:` and
         /// requires caller to call the `completionHandler`.
         public var dataTaskWillCacheResponseWithCompletion: ((Foundation.URLSession, URLSessionDataTask, CachedURLResponse, (CachedURLResponse?) -> Void) -> Void)?
 
@@ -552,8 +552,8 @@ public class Manager {
             - parameter session:           The session containing the data task that received an initial reply.
             - parameter dataTask:          The data task that received an initial reply.
             - parameter response:          A URL response object populated with headers.
-            - parameter completionHandler: A completion handler that your code calls to continue the transfer, passing a 
-                                           constant to indicate whether the transfer should continue as a data task or 
+            - parameter completionHandler: A completion handler that your code calls to continue the transfer, passing a
+                                           constant to indicate whether the transfer should continue as a data task or
                                            should become a download task.
         */
         public func urlSession(
@@ -616,12 +616,12 @@ public class Manager {
 
             - parameter session:           The session containing the data (or upload) task.
             - parameter dataTask:          The data (or upload) task.
-            - parameter proposedResponse:  The default caching behavior. This behavior is determined based on the current 
-                                           caching policy and the values of certain received headers, such as the Pragma 
+            - parameter proposedResponse:  The default caching behavior. This behavior is determined based on the current
+                                           caching policy and the values of certain received headers, such as the Pragma
                                            and Cache-Control headers.
-            - parameter completionHandler: A block that your handler must call, providing either the original proposed 
-                                           response, a modified version of that response, or NULL to prevent caching the 
-                                           response. If your delegate implements this method, it must call this completion 
+            - parameter completionHandler: A block that your handler must call, providing either the original proposed
+                                           response, a modified version of that response, or NULL to prevent caching the
+                                           response. If your delegate implements this method, it must call this completion
                                            handler; otherwise, your app leaks memory.
         */
         public func urlSession(
@@ -669,8 +669,8 @@ public class Manager {
 
             - parameter session:      The session containing the download task that finished.
             - parameter downloadTask: The download task that finished.
-            - parameter location:     A file URL for the temporary file. Because the file is temporary, you must either 
-                                      open the file for reading or move it to a permanent location in your app’s sandbox 
+            - parameter location:     A file URL for the temporary file. Because the file is temporary, you must either
+                                      open the file for reading or move it to a permanent location in your app’s sandbox
                                       container directory before returning from this delegate method.
         */
         public func urlSession(
@@ -690,11 +690,11 @@ public class Manager {
 
             - parameter session:                   The session containing the download task.
             - parameter downloadTask:              The download task.
-            - parameter bytesWritten:              The number of bytes transferred since the last time this delegate 
+            - parameter bytesWritten:              The number of bytes transferred since the last time this delegate
                                                    method was called.
             - parameter totalBytesWritten:         The total number of bytes transferred so far.
-            - parameter totalBytesExpectedToWrite: The expected length of the file, as provided by the Content-Length 
-                                                   header. If this header was not provided, the value is 
+            - parameter totalBytesExpectedToWrite: The expected length of the file, as provided by the Content-Length
+                                                   header. If this header was not provided, the value is
                                                    `NSURLSessionTransferSizeUnknown`.
         */
         public func urlSession(
@@ -722,11 +722,11 @@ public class Manager {
 
             - parameter session:            The session containing the download task that finished.
             - parameter downloadTask:       The download task that resumed. See explanation in the discussion.
-            - parameter fileOffset:         If the file's cache policy or last modified date prevents reuse of the 
-                                            existing content, then this value is zero. Otherwise, this value is an 
-                                            integer representing the number of bytes on disk that do not need to be 
+            - parameter fileOffset:         If the file's cache policy or last modified date prevents reuse of the
+                                            existing content, then this value is zero. Otherwise, this value is an
+                                            integer representing the number of bytes on disk that do not need to be
                                             retrieved again.
-            - parameter expectedTotalBytes: The expected length of the file, as provided by the Content-Length header. 
+            - parameter expectedTotalBytes: The expected length of the file, as provided by the Content-Length header.
                                             If this header was not provided, the value is NSURLSessionTransferSizeUnknown.
         */
         public func urlSession(

+ 7 - 7
Source/MultipartFormData.swift

@@ -31,10 +31,10 @@ import CoreServices
 #endif
 
 /**
-    Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode 
-    multipart form data. The first way is to encode the data directly in memory. This is very efficient, but can lead 
-    to memory issues if the dataset is too large. The second way is designed for larger datasets and will write all the 
-    data to a single file on disk with all the proper boundary segmentation. The second approach MUST be used for 
+    Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode
+    multipart form data. The first way is to encode the data directly in memory. This is very efficient, but can lead
+    to memory issues if the dataset is too large. The second way is designed for larger datasets and will write all the
+    data to a single file on disk with all the proper boundary segmentation. The second approach MUST be used for
     larger datasets such as video content, otherwise your app may run out of memory when trying to encode the dataset.
 
     For more information on `multipart/form-data` in general, please refer to the RFC-2388 and RFC-2045 specs as well
@@ -118,7 +118,7 @@ public class MultipartFormData {
         self.bodyParts = []
 
         /**
-         *  The optimal read/write buffer size in bytes for input and output streams is 1024 (1KB). For more 
+         *  The optimal read/write buffer size in bytes for input and output streams is 1024 (1KB). For more
          *  information, please refer to the following article:
          *    - https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Streams/Articles/ReadingInputStreams.html
          */
@@ -365,8 +365,8 @@ public class MultipartFormData {
     /**
         Encodes all the appended body parts into a single `NSData` object.
 
-        It is important to note that this method will load all the appended body parts into memory all at the same 
-        time. This method should only be used when the encoded data will have a small memory footprint. For large data 
+        It is important to note that this method will load all the appended body parts into memory all at the same
+        time. This method should only be used when the encoded data will have a small memory footprint. For large data
         cases, please use the `writeEncodedDataToDisk(fileURL:completionHandler:)` method.
 
         - throws: An `NSError` if encoding encounters an error.

+ 1 - 1
Source/NetworkReachabilityManager.swift

@@ -61,7 +61,7 @@ public class NetworkReachabilityManager {
         case wwan
     }
 
-    /// A closure executed when the network reachability status changes. The closure takes a single argument: the 
+    /// A closure executed when the network reachability status changes. The closure takes a single argument: the
     /// network reachability status.
     public typealias Listener = (NetworkReachabilityStatus) -> Void
 

+ 1 - 1
Source/Notifications.swift

@@ -32,7 +32,7 @@ public struct Notifications {
         /// `NSURLSessionTask`.
         public static let DidResume = "com.alamofire.notifications.task.didResume"
 
-        /// Notification posted when an `NSURLSessionTask` is suspended. The notification `object` contains the 
+        /// Notification posted when an `NSURLSessionTask` is suspended. The notification `object` contains the
         /// suspended `NSURLSessionTask`.
         public static let DidSuspend = "com.alamofire.notifications.task.didSuspend"
 

+ 5 - 5
Source/ParameterEncoding.swift

@@ -38,8 +38,8 @@ public enum Method: String {
 /**
     Used to specify the way in which a set of parameters are applied to a URL request.
 
-    - `URL`:             Creates a query string to be set as or appended to any existing URL query for `GET`, `HEAD`, 
-                         and `DELETE` requests, or set as the body for requests with any other HTTP method. The 
+    - `URL`:             Creates a query string to be set as or appended to any existing URL query for `GET`, `HEAD`,
+                         and `DELETE` requests, or set as the body for requests with any other HTTP method. The
                          `Content-Type` HTTP header field of an encoded request with HTTP body is set to
                          `application/x-www-form-urlencoded; charset=utf-8`. Since there is no published specification
                          for how to encode collection types, the convention of appending `[]` to the key for array
@@ -49,8 +49,8 @@ public enum Method: String {
     - `URLEncodedInURL`: Creates query string to be set as or appended to any existing URL query. Uses the same
                          implementation as the `.URL` case, but always applies the encoded result to the URL.
 
-    - `JSON`:            Uses `NSJSONSerialization` to create a JSON representation of the parameters object, which is 
-                         set as the body of the request. The `Content-Type` HTTP header field of an encoded request is 
+    - `JSON`:            Uses `NSJSONSerialization` to create a JSON representation of the parameters object, which is
+                         set as the body of the request. The `Content-Type` HTTP header field of an encoded request is
                          set to `application/json`.
 
     - `PropertyList`:    Uses `NSPropertyListSerialization` to create a plist representation of the parameters object,
@@ -74,7 +74,7 @@ public enum ParameterEncoding {
         - parameter URLRequest: The request to have parameters applied.
         - parameter parameters: The parameters to apply.
 
-        - returns: A tuple containing the constructed request and the error that occurred during parameter encoding, 
+        - returns: A tuple containing the constructed request and the error that occurred during parameter encoding,
                    if any.
     */
     public func encode(

+ 8 - 8
Source/Request.swift

@@ -25,7 +25,7 @@
 import Foundation
 
 /**
-    Responsible for sending a request and receiving the response and associated data from the server, as well as 
+    Responsible for sending a request and receiving the response and associated data from the server, as well as
     managing its underlying `NSURLSessionTask`.
 */
 public class Request {
@@ -126,12 +126,12 @@ public class Request {
     // MARK: - Progress
 
     /**
-        Sets a closure to be called periodically during the lifecycle of the request as data is written to or read 
+        Sets a closure to be called periodically during the lifecycle of the request as data is written to or read
         from the server.
 
-        - For uploads, the progress closure returns the bytes written, total bytes written, and total bytes expected 
+        - For uploads, the progress closure returns the bytes written, total bytes written, and total bytes expected
           to write.
-        - For downloads and data tasks, the progress closure returns the bytes read, total bytes read, and total bytes 
+        - For downloads and data tasks, the progress closure returns the bytes read, total bytes read, and total bytes
           expected to read.
 
         - parameter closure: The code to be executed periodically during the lifecycle of the request.
@@ -154,8 +154,8 @@ public class Request {
     /**
         Sets a closure to be called periodically during the lifecycle of the request as data is read from the server.
 
-        This closure returns the bytes most recently received from the server, not including data from previous calls. 
-        If this closure is set, data will only be available within this closure, and will not be saved elsewhere. It is 
+        This closure returns the bytes most recently received from the server, not including data from previous calls.
+        If this closure is set, data will only be available within this closure, and will not be saved elsewhere. It is
         also important to note that the `response` closure will be called with nil `responseData`.
 
         - parameter closure: The code to be executed periodically during the lifecycle of the request.
@@ -211,7 +211,7 @@ public class Request {
     // MARK: - TaskDelegate
 
     /**
-        The task delegate is responsible for handling all delegate callbacks for the underlying task as well as 
+        The task delegate is responsible for handling all delegate callbacks for the underlying task as well as
         executing all operations attached to the serial operation queue upon task completion.
     */
     public class TaskDelegate: NSObject {
@@ -462,7 +462,7 @@ public class Request {
 extension Request: CustomStringConvertible {
 
     /**
-        The textual representation used when written to an output stream, which includes the HTTP method and URL, as 
+        The textual representation used when written to an output stream, which includes the HTTP method and URL, as
         well as the response status code if a response has been received.
     */
     public var description: String {

+ 1 - 1
Source/Response.swift

@@ -44,7 +44,7 @@ public struct Response<Value, Error: ErrorProtocol> {
     /**
         Initializes the `Response` instance with the specified URL request, URL response, server data and response
         serialization result.
-    
+
         - parameter request:  The URL request sent to the server.
         - parameter response: The server's response to the URL request.
         - parameter data:     The data returned by the server.

+ 10 - 10
Source/ResponseSerialization.swift

@@ -102,7 +102,7 @@ extension Request {
         Adds a handler to be called once the request has finished.
 
         - parameter queue:              The queue on which the completion handler is dispatched.
-        - parameter responseSerializer: The response serializer responsible for serializing the request, response, 
+        - parameter responseSerializer: The response serializer responsible for serializing the request, response,
                                         and data.
         - parameter completionHandler:  The code to be executed once the request has finished.
 
@@ -194,10 +194,10 @@ extension Request {
 extension Request {
 
     /**
-        Creates a response serializer that returns a string initialized from the response data with the specified 
+        Creates a response serializer that returns a string initialized from the response data with the specified
         string encoding.
 
-        - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the server 
+        - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the server
                               response, falling back to the default HTTP default character set, ISO-8859-1.
 
         - returns: A string response serializer.
@@ -216,9 +216,9 @@ extension Request {
                 let error = Error.error(code: .stringSerializationFailed, failureReason: failureReason)
                 return .failure(error)
             }
-            
+
             var convertedEncoding = encoding
-            
+
             if let encodingName = response?.textEncodingName, convertedEncoding == nil {
                 convertedEncoding = String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(
                     CFStringConvertIANACharSetNameToEncoding(encodingName))
@@ -240,8 +240,8 @@ extension Request {
     /**
         Adds a handler to be called once the request has finished.
 
-        - parameter encoding:          The string encoding. If `nil`, the string encoding will be determined from the 
-                                       server response, falling back to the default HTTP default character set, 
+        - parameter encoding:          The string encoding. If `nil`, the string encoding will be determined from the
+                                       server response, falling back to the default HTTP default character set,
                                        ISO-8859-1.
         - parameter completionHandler: A closure to be executed once the request has finished.
 
@@ -267,7 +267,7 @@ extension Request {
 extension Request {
 
     /**
-        Creates a response serializer that returns a JSON object constructed from the response data using 
+        Creates a response serializer that returns a JSON object constructed from the response data using
         `NSJSONSerialization` with the specified reading options.
 
         - parameter options: The JSON serialization reading options. `.AllowFragments` by default.
@@ -326,7 +326,7 @@ extension Request {
 extension Request {
 
     /**
-        Creates a response serializer that returns an object constructed from the response data using 
+        Creates a response serializer that returns an object constructed from the response data using
         `NSPropertyListSerialization` with the specified reading options.
 
         - parameter options: The property list reading options. `NSPropertyListReadOptions()` by default.
@@ -362,7 +362,7 @@ extension Request {
 
         - parameter options:           The property list reading options. `0` by default.
         - parameter completionHandler: A closure to be executed once the request has finished. The closure takes 3
-                                       arguments: the URL request, the URL response, the server data and the result 
+                                       arguments: the URL request, the URL response, the server data and the result
                                        produced while creating the property list.
 
         - returns: The request.

+ 3 - 3
Source/Result.swift

@@ -27,9 +27,9 @@ import Foundation
 /**
     Used to represent whether a request was successful or encountered an error.
 
-    - Success: The request and all post processing operations were successful resulting in the serialization of the 
+    - Success: The request and all post processing operations were successful resulting in the serialization of the
                provided associated value.
-    - Failure: The request encountered an error resulting in a failure. The associated values are the original data 
+    - Failure: The request encountered an error resulting in a failure. The associated values are the original data
                provided by the server as well as the error that caused the failure.
 */
 public enum Result<Value, Error: ErrorProtocol> {
@@ -75,7 +75,7 @@ public enum Result<Value, Error: ErrorProtocol> {
 // MARK: - CustomStringConvertible
 
 extension Result: CustomStringConvertible {
-    /// The textual representation used when written to an output stream, which includes whether the result was a 
+    /// The textual representation used when written to an output stream, which includes whether the result was a
     /// success or failure.
     public var description: String {
         switch self {

+ 18 - 18
Source/ServerTrustPolicy.swift

@@ -32,9 +32,9 @@ public class ServerTrustPolicyManager {
     /**
         Initializes the `ServerTrustPolicyManager` instance with the given policies.
 
-        Since different servers and web services can have different leaf certificates, intermediate and even root 
-        certficates, it is important to have the flexibility to specify evaluation policies on a per host basis. This 
-        allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key 
+        Since different servers and web services can have different leaf certificates, intermediate and even root
+        certficates, it is important to have the flexibility to specify evaluation policies on a per host basis. This
+        allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key
         pinning for host3 and disabling evaluation for host4.
 
         - parameter policies: A dictionary of all policies mapped to a particular host.
@@ -80,31 +80,31 @@ extension URLSession {
 // MARK: - ServerTrustPolicy
 
 /**
-    The `ServerTrustPolicy` evaluates the server trust generally provided by an `NSURLAuthenticationChallenge` when 
-    connecting to a server over a secure HTTPS connection. The policy configuration then evaluates the server trust 
+    The `ServerTrustPolicy` evaluates the server trust generally provided by an `NSURLAuthenticationChallenge` when
+    connecting to a server over a secure HTTPS connection. The policy configuration then evaluates the server trust
     with a given set of criteria to determine whether the server trust is valid and the connection should be made.
 
-    Using pinned certificates or public keys for evaluation helps prevent man-in-the-middle (MITM) attacks and other 
-    vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged 
+    Using pinned certificates or public keys for evaluation helps prevent man-in-the-middle (MITM) attacks and other
+    vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged
     to route all communication over an HTTPS connection with pinning enabled.
 
-    - PerformDefaultEvaluation: Uses the default server trust evaluation while allowing you to control whether to 
-                                validate the host provided by the challenge. Applications are encouraged to always 
-                                validate the host in production environments to guarantee the validity of the server's 
+    - PerformDefaultEvaluation: Uses the default server trust evaluation while allowing you to control whether to
+                                validate the host provided by the challenge. Applications are encouraged to always
+                                validate the host in production environments to guarantee the validity of the server's
                                 certificate chain.
 
     - PinCertificates:          Uses the pinned certificates to validate the server trust. The server trust is
-                                considered valid if one of the pinned certificates match one of the server certificates. 
-                                By validating both the certificate chain and host, certificate pinning provides a very 
-                                secure form of server trust validation mitigating most, if not all, MITM attacks. 
-                                Applications are encouraged to always validate the host and require a valid certificate 
+                                considered valid if one of the pinned certificates match one of the server certificates.
+                                By validating both the certificate chain and host, certificate pinning provides a very
+                                secure form of server trust validation mitigating most, if not all, MITM attacks.
+                                Applications are encouraged to always validate the host and require a valid certificate
                                 chain in production environments.
 
     - PinPublicKeys:            Uses the pinned public keys to validate the server trust. The server trust is considered
-                                valid if one of the pinned public keys match one of the server certificate public keys. 
-                                By validating both the certificate chain and host, public key pinning provides a very 
-                                secure form of server trust validation mitigating most, if not all, MITM attacks. 
-                                Applications are encouraged to always validate the host and require a valid certificate 
+                                valid if one of the pinned public keys match one of the server certificate public keys.
+                                By validating both the certificate chain and host, public key pinning provides a very
+                                secure form of server trust validation mitigating most, if not all, MITM attacks.
+                                Applications are encouraged to always validate the host and require a valid certificate
                                 chain in production environments.
 
     - DisableEvaluation:        Disables all evaluation which in turn will always consider any server trust as valid.

+ 4 - 4
Source/Timeline.swift

@@ -54,10 +54,10 @@ public struct Timeline {
         Creates a new `Timeline` instance with the specified request times.
 
         - parameter requestStartTime:           The time the request was initialized. Defaults to `0.0`.
-        - parameter initialResponseTime:        The time the first bytes were received from or sent to the server. 
+        - parameter initialResponseTime:        The time the first bytes were received from or sent to the server.
                                                 Defaults to `0.0`.
         - parameter requestCompletedTime:       The time when the request was completed. Defaults to `0.0`.
-        - parameter serializationCompletedTime: The time when the response serialization was completed. Defaults 
+        - parameter serializationCompletedTime: The time when the response serialization was completed. Defaults
                                                 to `0.0`.
 
         - returns: The new `Timeline` instance.
@@ -83,7 +83,7 @@ public struct Timeline {
 // MARK: - CustomStringConvertible
 
 extension Timeline: CustomStringConvertible {
-    /// The textual representation used when written to an output stream, which includes the latency, the request 
+    /// The textual representation used when written to an output stream, which includes the latency, the request
     /// duration and the total duration.
     public var description: String {
         let latency = String(format: "%.3f", self.latency)
@@ -107,7 +107,7 @@ extension Timeline: CustomStringConvertible {
 // MARK: - CustomDebugStringConvertible
 
 extension Timeline: CustomDebugStringConvertible {
-    /// The textual representation used when written to an output stream, which includes the request start time, the 
+    /// The textual representation used when written to an output stream, which includes the request start time, the
     /// initial response time, the request completed time, the serialization completed time, the latency, the request
     /// duration and the total duration.
     public var debugDescription: String {

+ 11 - 11
Source/Upload.swift

@@ -194,12 +194,12 @@ extension Manager {
     public static let MultipartFormDataEncodingMemoryThreshold: UInt64 = 10 * 1024 * 1024
 
     /**
-        Defines whether the `MultipartFormData` encoding was successful and contains result of the encoding as 
+        Defines whether the `MultipartFormData` encoding was successful and contains result of the encoding as
         associated values.
 
-        - Success: Represents a successful `MultipartFormData` encoding and contains the new `Request` along with 
+        - Success: Represents a successful `MultipartFormData` encoding and contains the new `Request` along with
                    streaming information.
-        - Failure: Used to represent a failure in the `MultipartFormData` encoding and also contains the encoding 
+        - Failure: Used to represent a failure in the `MultipartFormData` encoding and also contains the encoding
                    error.
     */
     public enum MultipartFormDataEncodingResult {
@@ -210,17 +210,17 @@ extension Manager {
     /**
         Encodes the `MultipartFormData` and creates a request to upload the result to the specified URL request.
 
-        It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative 
-        payload is small, encoding the data in-memory and directly uploading to a server is the by far the most 
-        efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to 
-        be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory 
-        footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be 
+        It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative
+        payload is small, encoding the data in-memory and directly uploading to a server is the by far the most
+        efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to
+        be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory
+        footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be
         used for larger payloads such as video content.
 
-        The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory 
+        The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory
         or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,
-        encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk 
-        during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding 
+        encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk
+        during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding
         technique was used.
 
         If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.

+ 2 - 2
Source/Validation.swift

@@ -38,7 +38,7 @@ extension Request {
     }
 
     /**
-        A closure used to validate a request that takes a URL request and URL response, and returns whether the 
+        A closure used to validate a request that takes a URL request and URL response, and returns whether the
         request was valid.
     */
     public typealias Validation = (Foundation.URLRequest?, HTTPURLResponse) -> ValidationResult
@@ -189,7 +189,7 @@ extension Request {
     // MARK: - Automatic
 
     /**
-        Validates that the response has a status code in the default acceptable range of 200...299, and that the content 
+        Validates that the response has a status code in the default acceptable range of 200...299, and that the content
         type matches any specified in the Accept HTTP header field.
 
         If validation fails, subsequent calls to response handlers will have an associated error.

+ 1 - 1
Tests/CacheTests.swift

@@ -124,7 +124,7 @@ class CacheTestCase: BaseTestCase {
 
     /**
         Executes a request for all `Cache-Control` header values to load the response into the `URLCache`.
-    
+
         This implementation leverages dispatch groups to execute all the requests as well as wait an additional
         second before returning. This ensures the cache contains responses for all requests that are at least
         one second old. This allows the tests to distinguish whether the subsequent responses come from the cache

+ 2 - 2
Tests/MultipartFormDataTests.swift

@@ -155,7 +155,7 @@ class MultipartFormDataEncodingTestCase: BaseTestCase {
         multipartFormData.appendBodyPart(data: french, name: "french")
         multipartFormData.appendBodyPart(data: japanese, name: "japanese", mimeType: "text/plain")
         multipartFormData.appendBodyPart(data: emoji, name: "emoji", mimeType: "text/plain")
-        
+
         var encodedData: Data?
 
         // When
@@ -808,7 +808,7 @@ class MultipartFormDataWriteEncodedDataToDiskTestCase: BaseTestCase {
 
 class MultipartFormDataFailureTestCase: BaseTestCase {
     func testThatAppendingFileBodyPartWithInvalidLastPathComponentReturnsError() {
-        // Given 
+        // Given
         let fileURL = URL(string: "")!
         let multipartFormData = MultipartFormData()
         multipartFormData.appendBodyPart(fileURL: fileURL, name: "empty_data")

+ 3 - 3
Tests/ParameterEncodingTests.swift

@@ -45,14 +45,14 @@ class URLParameterEncodingTestCase: ParameterEncodingTestCase {
         // Then
         XCTAssertNil(URLRequest.url?.query, "query should be nil")
     }
-    
+
     func testURLParameterEncodeEmptyDictionaryParameter() {
         // Given
         let parameters: [String: AnyObject] = [:]
-        
+
         // When
         let (URLRequest, _) = encoding.encode(self.urlRequest, parameters: parameters)
-        
+
         // Then
         XCTAssertNil(URLRequest.url?.query, "query should be nil")
     }

+ 2 - 2
Tests/RequestTests.swift

@@ -486,10 +486,10 @@ class RequestDebugDescriptionTestCase: BaseTestCase {
     let managerWithAcceptLanguageHeader: Manager = {
         var headers = Alamofire.Manager.sharedInstance.session.configuration.httpAdditionalHeaders ?? [:]
         headers["Accept-Language"] = "en-US"
-        
+
         let configuration = URLSessionConfiguration.default
         configuration.httpAdditionalHeaders = headers
-        
+
         let manager = Manager(configuration: configuration)
         manager.startRequestsImmediately = false
         return manager

+ 1 - 1
Tests/ServerTrustPolicyTests.swift

@@ -960,7 +960,7 @@ class ServerTrustPolicyPinCertificatesTestCase: ServerTrustPolicyTestCase {
 
         // When
         let serverTrustIsValid = serverTrustPolicy.evaluateServerTrust(serverTrust, isValidForHost: host)
-        
+
         // Then
         XCTAssertTrue(serverTrustIsValid, "server trust should pass evaluation")
     }

+ 2 - 4
Tests/SessionDelegateTests.swift

@@ -515,10 +515,8 @@ class SessionDelegateTestCase: BaseTestCase {
         XCTAssertNotNil(response?.response, "response should not be nil")
         XCTAssertNotNil(response?.data, "data should not be nil")
         XCTAssertTrue(response?.result.isSuccess ?? false, "response result should be a success")
-        
-        if let json = response?.result.value as? [String: AnyObject],
-           let headers = json["headers"] as? [String: String]
-        {
+
+        if let json = response?.result.value as? [String: AnyObject], let headers = json["headers"] as? [String: String] {
             XCTAssertEqual(headers["Custom-Header"], "foobar", "Custom-Header should be equal to foobar")
             XCTAssertEqual(headers["Authorization"], "1234", "Authorization header should be equal to 1234")
         }