Skip to content

Swift 3 API for NSURLSession's uploadTask 'from' parameter #641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Foundation/NSURLSession/NSURLSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ open class URLSession : NSObject {
}

/* Creates an upload task with the given request. The body of the request is provided from the bodyData. */
open func uploadTask(with request: URLRequest, fromData bodyData: Data) -> URLSessionUploadTask {
open func uploadTask(with request: URLRequest, from bodyData: Data) -> URLSessionUploadTask {
let r = URLSession._Request(request)
return uploadTask(with: r, body: .data(createDispatchData(bodyData)), behaviour: .callDelegate)
}
Expand Down Expand Up @@ -433,10 +433,10 @@ extension URLSession {
*/
open func uploadTask(with request: URLRequest, fromFile fileURL: URL, completionHandler: @escaping (Data?, URLResponse?, NSError?) -> Void) -> URLSessionUploadTask {
let fileData = try! Data(contentsOf: fileURL)
return uploadTask(with: request, fromData: fileData, completionHandler: completionHandler)
return uploadTask(with: request, from: fileData, completionHandler: completionHandler)
}

open func uploadTask(with request: URLRequest, fromData bodyData: Data?, completionHandler: @escaping (Data?, URLResponse?, NSError?) -> Void) -> URLSessionUploadTask {
open func uploadTask(with request: URLRequest, from bodyData: Data?, completionHandler: @escaping (Data?, URLResponse?, NSError?) -> Void) -> URLSessionUploadTask {
return uploadTask(with: _Request(request), body: .data(createDispatchData(bodyData!)), behaviour: .dataCompletionHandler(completionHandler))
}

Expand Down