Description
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
/await
and 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