title: How to pass credentials through a fetch request
body: <p>I can't pass credentials to avoid of the authentication dialog when GET request is sending as health check to RabbitMQ API.
  If I pass url with the credentials inside 
  <em>(e.g. <a href="http://user:pass@localhost:15672/api/aliveness-test/%2F" rel="noreferrer">http://user:pass@localhost:15672/api/aliveness-test/%2F</a>)</em> </p>
  
  <p>it receives the error below - </p>
  
  <pre><code>rabbitCol.js:12 Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'Window': Request cannot be constructed from a URL that includes credentials: http://user:pass@localhost:15672/api/aliveness-test/%2F
      at rabbitColChecking (rabbitCol.js:12)
      at allReqInt (allReqInt.js:5)
      at HTMLAnchorElement.onclick ((index):108)
  </code></pre>
  
  <p>If I sending this request without the credentials inside the url it's actually sent the request ok but the authentication dialog pop ups in the UI and it's annoying and not a pretty as well.</p>
  
  <p><strong>The request is below -</strong></p>
  
  <pre><code>var fetch = require('node-fetch');
  
      async function rabbitColChecking() {
          let index;
          const hostsRB = ['http://user:pass@host1:15672/api/aliveness-test/%2F', 'http://user:pass@host2:15672/api/aliveness-test/%2F', 'http://user:pass@host3:15672/api/aliveness-test/%2F', 'http://user:pass@host4:15672/api/aliveness-test/%2F];
          let lengthVal = hostsRB.length;
          for(let hostIndxRB = 0; hostIndxRB &lt; lengthVal; hostIndxRB++) {
              index = hostIndxRB;
              let url = hostsRB[hostIndxRB];
              fetch(url, {method: 'GET', credentials:'same-origin', redirect: 'follow', agent: null, headers: {"Content-Type": "text/plain"}, timeout: 5000}
          ).then(function (hostindxRB, res) {
                  handleLedResponseRB(res, hostindxRB);
              }.bind(null, hostIndxRB));
              await sleep(500);
          }
      }
  </code></pre>
  
  <p>The trigger to send this request is a "onclick" function inside some HTML file.</p>
  
  <p>I've actually tried every solution I saw in the net, but nothing solves this use case.</p>