You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ℹ Please fill out this template when filing a feature request.
All lines beginning with an ℹ symbol instruct you with what info we expect. You can delete those lines once you've filled in the info.
Feature requests should code examples whenever possible.
Per our *CONTRIBUTING guidelines, we use GitHub for
bugs and feature requests, not general support. Other issues should be opened on Stack Overflow with the tag alamofire.
Please remove this line and everything above it before submitting.
Currently when I download a file using AF.download, if the request fails the error response is downloaded. I'm only interested in the status code and don't want to download the error content, or at least I don't want to download the error content as the file.
Feature Request
Provide a way to either not download the error content, or download it in memory and not to a file.
Value to Alamofire
This seems like a reasonable way to handle download errors in general, but it seems like Alamofire doesn't provide a way to do it.
The text was updated successfully, but these errors were encountered:
This could be a useful general feature, not just for downloads but for all request types. We can implement urlSession(_:dataTask:didReceive:completionHandler:) and call back to the request to allow for customization. However, URLSession only allows for cancellation here, which isn't the greatest experience in the response, so we would probably need to map it into a better value or error.
jshier
changed the title
Option to not download an error response with AF.download
Allow customization of initial HTTPURLResponse handling
Apr 12, 2021
Further investigation shows that properly supporting this sort of flow (check initial response for a successful code or other success state, download data if it's an error, but download a file to disk if it's a success) is only possible if Alamofire supports turning URLSessionDataTasks into URLSessionDownloadTasks, which isn't possible given the current architecture. This would be a very challenging design task, as Alamofire would not only need internal changes to support it, but would then need to design an API surface for a Request type that provides a mix of DataRequest and DownloadRequest functionality. A tall order but an interesting challenge.
Given that complexity and how easy it is create a custom ResponseSerializer that reads the failure Data from disk, it's unlikely Alamofire will ever support this functionality. I'll leave this issue open for now, pending further investigation.
jshier
changed the title
Allow customization of initial HTTPURLResponse handling
Support URLSessionDataTask to URLSessionDownloadTask Evolution
Oct 21, 2021
jshier
changed the title
Support URLSessionDataTask to URLSessionDownloadTask Evolution
Support URLSessionDataTask to URLSessionDownloadTask Upgrades
Oct 21, 2021
Problem
Currently when I download a file using
AF.download
, if the request fails the error response is downloaded. I'm only interested in the status code and don't want to download the error content, or at least I don't want to download the error content as the file.Feature Request
Provide a way to either not download the error content, or download it in memory and not to a file.
Value to Alamofire
This seems like a reasonable way to handle download errors in general, but it seems like Alamofire doesn't provide a way to do it.
The text was updated successfully, but these errors were encountered: