     }
     
     // MARK: - Public property
+    
+    /// This closure will be applied to the image download request before it being sent. You can modify the request for some customizing purpose, like adding auth token to the header or do a url mapping.
+    public var requestModifier: (NSMutableURLRequest -> Void)?
+
     /// The duration before the download is timeout. Default is 15 seconds.
     public var downloadTimeout: NSTimeInterval = 15.0
     

    
    public func URLSession(session: NSURLSession, task: NSURLSessionTask, didCompleteWithError error: NSError?) {
        
        let URL = task.originalRequest.URL!
        
        if let error = error { // Error happened
            callbackWithImage(nil, error: error, imageURL: URL)
        } else { //Download finished without error
            
            // We are on main queue when receiving this.
            dispatch_async(processQueue, { () -> Void in
                
                if let fetchLoad = self.fetchLoads[URL] {
                    if let image = UIImage(data: fetchLoad.responseData) {
                        if fetchLoad.shouldDecode {
                            self.callbackWithImage(image.kf_decodedImage(), error: nil, imageURL: URL)
                        } else {
                            self.callbackWithImage(image, error: nil, imageURL: URL)
                        }

                    } else {
                        self.callbackWithImage(nil, error: NSError(domain: KingfisherErrorDomain, code: KingfisherError.BadData.rawValue, userInfo: nil), imageURL: URL)
                    }
                } else {
                    self.callbackWithImage(nil, error: NSError(domain: KingfisherErrorDomain, code: KingfisherError.BadData.rawValue, userInfo: nil), imageURL: URL)
                }
                
                self.cleanForURL(URL)
            })
        }
    }


            let timeout = self.downloadTimeout == 0.0 ? 15.0 : self.downloadTimeout
            let request = NSMutableURLRequest(URL: URL, cachePolicy: .ReloadIgnoringLocalCacheData, timeoutInterval: timeout)
            request.HTTPShouldUsePipelining = true

            self.requestModifier?(request)
            
            let task = session.dataTaskWithRequest(request)
            
            task.priority = options.lowPriority ? NSURLSessionTaskPriorityLow : NSURLSessionTaskPriorityDefault
