Skip to content
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

File upload/download has confusing async behaviour #37

Open
plajdo opened this issue Nov 26, 2024 · 0 comments
Open

File upload/download has confusing async behaviour #37

plajdo opened this issue Nov 26, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@plajdo
Copy link
Contributor

plajdo commented Nov 26, 2024

Describe the bug
File upload (or download) has confusing behaviour - function is async, but it returns Alamofire.UploadRequest.

Expected behavior
A1) function is synchronous, throws on failure and returns UploadRequest

func uploadWithMultipart(...) throws(NetworkError) -> UploadRequest

A2) function is synchronous, doesn't return, accepts a completion handler

func uploadWithMultipart(..., completionHandler: (Result) -> Void) throws(NetworkError)

B1) function is asynchronous, doesn't return, and ends after file upload/download is complete or throws

func uploadWithMutlipart(...) async throws(NetworkError)

B2) function is asynchronous, returns the result of upload/download operation after file upload/download is complete

func uploadWithMutlipart(...) async -> Result

Result => some, at the time of reporting unknown concrete result type. Can be from Alamofire/local enum/Swift's Result type etc.

@plajdo plajdo added the bug Something isn't working label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants