Skip to content

File upload/download has confusing async behaviour #37

@plajdo

Description

@plajdo

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions