-
Notifications
You must be signed in to change notification settings - Fork 147
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
Update Alamofire #273
Update Alamofire #273
Conversation
@yonaskolb Is there any suggestions to merge this PR? I'm welcome any revise request :) |
encodingCompletion: { result in | ||
switch result { | ||
case .success(let uploadRequest, _, _): | ||
cancellableRequest.networkRequest = uploadRequest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is all this still required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yonaskolb Thank you for your comment! Sorry, I'm not sure your comment so could you describe more detail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alamofire 5 removes encodingCompletion
.
https://stackoverflow.com/questions/54985001/alamofire-5-upload-encodingcompletion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yonaskolb Oh, I got it. I have to add responseData
method to handle response.
I will revise this code to as follows. Did I get that right?
cancellableRequest.networkRequest = sessionManager.upload(
multipartFormData: { multipartFormData in
for (name, value) in request.formParameters {
if let file = value as? UploadFile {
switch file.type {
case let .url(url):
if let fileName = file.fileName, let mimeType = file.mimeType {
multipartFormData.append(url, withName: name, fileName: fileName, mimeType: mimeType)
} else {
multipartFormData.append(url, withName: name)
}
case let .data(data):
if let fileName = file.fileName, let mimeType = file.mimeType {
multipartFormData.append(data, withName: name, fileName: fileName, mimeType: mimeType)
} else {
multipartFormData.append(data, withName: name)
}
}
} else if let url = value as? URL {
multipartFormData.append(url, withName: name)
} else if let data = value as? Data {
multipartFormData.append(data, withName: name)
} else if let string = value as? String {
multipartFormData.append(Data(string.utf8), withName: name)
}
}
},
with: urlRequest
).responseData(queue: decodingQueue) { dataResponse in
self.handleResponse(request: request, requestBehaviour: requestBehaviour, dataResponse: dataResponse, completionQueue: completionQueue, complete: complete)
}
Thanks for preparing the PR, any news on the PR review? |
@b00tsy I'm waiting comments from @yonaskolb :) |
Sorry for the delay @0x0c! I got your great work over the line for you! |
@yonaskolb Thanks a lot! |
* Update Alamofire * Store upload request. * Update build_spec.sh * commit diffs * update changelog * handle upload response Co-authored-by: yonaskolb <[email protected]>
Hi, I updated Alamofire 4.9.0 to 5.4.3 (latest version) and also update templates to confirm Alamofire's API changes.
I checked all tests are passed and a generated client can send request.