title: How to change the user-agent in react native fetch api
body: <p>I have tried to change the user agent in react native fetch API:</p>
  
  <pre><code>const URLENCODED_HEADER = {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'User-Agent': Platform.OS + "/" + DeviceInfo.getUniqueID().toString()
  }
  
  export async function doRegister(secureInfo) {
    formBody = encodeParameters(secureInfo)
    try {
      let response = await fetch(SERVER_URL+'/user/register', {
        method: "POST",
        headers: URLENCODED_HEADER,
        body: formBody,
        credentials: 'include'
      });
      let responseJson = await response.json();
      return responseJson;
    } catch(error) {
      console.error(error);
      throw error;
    }
  }
  </code></pre>
  
  <p>I have also checked the requests' header in Reactotron:
  <a href="https://i.stack.imgur.com/itOqK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/itOqK.png" alt="enter image description here"></a></p>
  
  <p>And it shows the correct information I want. </p>
  
  <p>However, on the server side, the <code>ua</code> is still the default for android and ios devices:</p>
  
  <p><code>Mozilla/5.0 (iPad; CPU OS 11_2_6 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0 Mobile/15D100 Safari/604.1</code></p>
  
  <p><code>okhttp/3.6.0</code></p>
  
  <p><code>Dalvik/2.1.0 (Linux; U; Android 5.1.1; Coolpad 3622A Build/LMY47V)</code></p>
  
  <p>Is it possible to change the <code>user-agent</code> for requests sent in react-native and how if so?</p>