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
735 stars 336 forks source link

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

Open zatteo opened 1 year ago

zatteo commented 1 year 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