Vydia / react-native-background-upload

Upload files in your React Native app even while it's backgrounded. Supports Android and iOS, including camera roll assets.
MIT License
720 stars 325 forks source link

feat(android): Return response code and body when error on Android #337

Open zatteo opened 11 months ago

zatteo commented 11 months ago

Summary

When there was an error, plugin would just return "upload error". Now, if it is an upload error, plugin return also the response code and body. This enable user to add custom behavior when receiving an upload error depending on the server.

This PR is just forwarding response code and body from android-upload-service.

Test Plan

What's required for testing (prerequisites)?

A server that return a 4XX.

What are the steps to reproduce (after prerequisites)?

Create an upload which should fail with a 4XX. Check that the errorData contains responseCode and responseBody.

Compatibility

OS Implemented
iOS
Android

Checklist