Skip to content

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

Open
@andreaforni

Description

@andreaforni

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions