title: React Native fetch() not working android
body: <p>I am trying to call <code>fetch()</code> function.</p>
  
  <p>It works fine on iOS but not working on Android.</p>
  
  <pre><code>fetch('https://admin.leanpoint.com/Api/User/Login?user=srinu@mainpoint.dk', { 
    method: 'POST', 
    headers: {
      'Authorization': 'Basic c3JpbnVAbWFpbnBvaW50LmRrOnNhaWJhYmE='
    },
  })
  .then((res) =&gt; {
    res.json().then((json) =&gt; {
      alert(JSON.stringify(json))
    })
  })
  .catch((err) =&gt; {
    alert(JSON.stringify(err))
  })
  </code></pre>
  
  <p>On iOS, it enters <code>.then()</code> but on Android it enters <code>.catch()</code> and <code>err</code> is <code>{}</code>.</p>
  
  <p>It is not working on Emulator and real device as well.</p>
  
  <p>Any help is appreciated. ^_^</p>
  
  <blockquote>
    <p>Error log using Axios</p>
  </blockquote>
  
  <p>When I used <code>fetch()</code> it enters <code>.catch()</code> with {}.</p>
  
  <p>I tried with <code>Axios</code> as below.</p>
  
  <pre><code>axios.post('https://admin.leanpoint.com/Api/User/Login?user=srinu@mainpoint.dk', null, {
        headers: {
          'Authorization': 'Basic c3JpbnVAbWFpbnBvaW50LmRrOnNhaWJhYmE='
        },
        timeout: 2000
      })
      .then((res) =&gt; {
        console.log(res.data)
      })
      .catch((err) =&gt; {
        console.log(err)
      })
  </code></pre>
  
  <p>And it returns error like below.</p>
  
  <pre><code>{ [Error: Network Error]
    config:
     { adapter: [Function: xhrAdapter],
       transformRequest: { '0': [Function: transformRequest] },
       transformResponse: { '0': [Function: transformResponse] },
       timeout: 2000,
       xsrfCookieName: 'XSRF-TOKEN',
       xsrfHeaderName: 'X-XSRF-TOKEN',
       maxContentLength: -1,
       validateStatus: [Function: validateStatus],
       headers:
        { Accept: 'application/json, text/plain, */*',
          'Content-Type': 'application/x-www-form-urlencoded',
          Authorization: 'Basic c3JpbnVAbWFpbnBvaW50LmRrOnNhaWJhYmE=' },
       method: 'post',
       url: 'https://admin.leanpoint.com/Api/User/Login?user=srinu@mainpoint.dk',
       data: null },
    request:
     { UNSENT: 0,
       OPENED: 1,
       HEADERS_RECEIVED: 2,
       LOADING: 3,
       DONE: 4,
       readyState: 4,
       status: 0,
       timeout: 2000,
       withCredentials: true,
       upload: {},
       _aborted: false,
       _hasError: true,
       _method: 'POST',
       _response: 'java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.',
       _url: 'https://admin.leanpoint.com/Api/User/Login?user=srinu@mainpoint.dk',
       _timedOut: false,
       _trackingName: 'unknown',
       _incrementalEvents: false,
       responseHeaders: undefined,
       _requestId: null,
       _cachedResponse: undefined,
       _headers:
        { accept: 'application/json, text/plain, */*',
          'content-type': 'application/x-www-form-urlencoded',
          authorization: 'Basic c3JpbnVAbWFpbnBvaW50LmRrOnNhaWJhYmE=' },
       _responseType: '',
       _sent: true,
       _lowerCaseResponseHeaders: {},
       _subscriptions: [] },
    response: undefined }
  </code></pre>