-
Notifications
You must be signed in to change notification settings - Fork 135
downloadFile should not return when statusCode is not in 2xx range #37
Comments
Any statuscode that is not in the range of 2xx should reject the downloadFile method invocation. capacitor-community#37
You could also argue about if the following code should result in an error: await Http.request({
url: 'http://httpstat.us/404',
method: 'GET'
}); I would expect this (if I compare it to the Angular HttpClient): This way people can, perhaps, more easily use this api without specifically having to interpret the statusCode. But I guess this has been implemented this way deliberately, right? |
I believe it was modeled after |
For the "Http.request" part I can agree. The downloadFile method should reject or we should add the statuscode in the response so the user can decide what to do with it. But then the method should not create a file on filesystem. |
Agreed, |
Any statuscode that is not in the range of 2xx should reject the downloadFile method invocation. #37
Describe the bug
Using the
downloadFile
method successfully resolves even when the http statuscode is not in the 2xx range.To Reproduce
Steps to reproduce the behavior:
Expected behavior
I would expect the method to fail since the http statuscode in the example is equal to: 404.
Any statuscode that is not in the range of 2xx should reject the downloadFile method invocation.
On ios and web the downloadFile method will resolve successfully. On android you will end up in your catch block (like expected).
So there's a mismatch in Capacitor http api depending on the platform that should be handled by this plugin.
Screenshots
N/A
Additional context
The text was updated successfully, but these errors were encountered: