title: Basic authentication with fetch?
body: <p>I want to write a simple basic authentication with fetch, but I keep getting a 401 error. It would be awesome if someone tells me what's wrong with the code:</p>
  <pre><code>let base64 = require('base-64');
  
  let url = 'http://eu.httpbin.org/basic-auth/user/passwd';
  let username = 'user';
  let password = 'passwd';
  
  let headers = new Headers();
  
  //headers.append('Content-Type', 'text/json');
  headers.append('Authorization', 'Basic' + base64.encode(username + &quot;:&quot; + password));
  
  fetch(url, {method:'GET',
          headers: headers,
          //credentials: 'user:passwd'
         })
  .then(response =&gt; response.json())
  .then(json =&gt; console.log(json));
  //.done();
  </code></pre>