Reputation: 785
I'm having issue with resumable upload, using URLSession in iOS. Everything works, except the resumable upload. The session upload creation works, I've got my uploadUrl back, so I simply start an URLSessionUploadTask:
let url = URL(string: urlUploadString)!
var urlRequest = URLRequest(url: url)
urlRequest.httpMethod = "PUT"
urlRequest.setValue("bearer \(accessToken)", forHTTPHeaderField: "Authorization")
let task = urlsession.uploadTask(with: urlRequest, fromFile: localFile)
task.resume()
The transfer goes through, however, in the end, I receive a http code 400 with the response:
["error": {
code = invalidRequest;
message = "Invalid Content-Range header value";
}]
The thing, I can't set the Content-Range header per chunk, because iOS handles the upload, not me. And it doesn't seem to set Content-Range header automatically for each chunk sent.
Upvotes: 0
Views: 122