     }
     return dataTask(with: request)
 }
-
+//data task
 public func dataTask(with request:URLRequest)->WTURLSessionDataTask{
     let task = WTURLSessionManager.default.session!.dataTask(with: request)
     let myTask = WTURLSessionDataTask(task: task)

    myTask.resume()
    return myTask
}
open class WTURLSessionDelegate:NSObject{
    
}

    }
    
}


//下载进度
public typealias downloadProgressHandler = ((URLSession,URLSessionDownloadTask,Int64,Int64,Int64)->Swift.Void)
public typealias downloadTaskDidFinishDownloadingToURL = ((URLSession, URLSessionDownloadTask, URL)->Void)

open class WTURLSessionDownloadTask:WTURLSessionTask,URLSessionDownloadDelegate{
    var downloadTaskFinishHandler:downloadTaskDidFinishDownloadingToURL?
    var downloadProgressHandler:downloadProgressHandler?
    public func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL)
    {
        if let handler = downloadTaskFinishHandler {
            handler(session,downloadTask,location)
        }
    }
    
    public func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64){
        if let handler = downloadProgressHandler {
            handler(session,downloadTask,bytesWritten,totalBytesWritten,totalBytesExpectedToWrite)
        }
    }
    
    public func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didResumeAtOffset fileOffset: Int64, expectedTotalBytes: Int64)
    {
        
    }
}
