Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: error management in the request method does not correctly work if fetch by react-native-ssl-pinning isn't used #53

Open
andreaforni opened this issue Aug 31, 2020 · 0 comments

Comments

@andreaforni
Copy link
Contributor

The API request method uses the fetch function to call the back-end API. The method was developed to support SSL pinning but its support has been commented out (here and there)

There is an important difference between JavaScript fetch and the one provided by react-native-ssl-pinning package: how HTTP error status is managed.

JavaScripts fetch does not reject on HTTP error status even if the response is an HTTP 404 or 500; it normally resolves the promise. On the other hand, the one provided by react-native-ssl-pinning returns a rejected promise.

The request method was originally developed to work with SSL pinning's version, so all HTTP errors are managed in the catch block (it uses async/awaitand rejected promises throw an exception). Now that the import of that fetch is commented out, the vanilla version is used and the error management code in the catch block is not executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant