title: POSTing to a basic access authorization protected resource
body: <p>I am experiencing a problem while POSTing to a resource which is protected by basic access authentication.
  Here is the code, I am using <a href="https://github.com/mikeal/request" rel="nofollow">@mikeal's request</a>:</p>
  
  <pre><code>request.post({
    uri: "http://user:password@mysite.com/resource",
    json: {
      "id": "1",
      "par1": "a",
      "par2": "b"
    }
  }, function (error, response, body) {
    console.log(error);
    console.log(response);
    console.log(body);
  });
  </code></pre>
  
  <p>I have <code>{ [Error: Parse Error] bytesParsed: 0 }</code> in error and <code>undefined</code> in both response and body. If I remove the "user:password" part I correctly get a 401 HTTP Basic: Access denied.</p>
  
  <p>Do you know if there's a way to POST JSON to a protected resource like in my case? If not, I believe I'll have to go the http module way, but I'm leaving that as a final resource since it's a lot more verbose.</p>
  
  <p>UPDATE: To have this as simple as possible I've moved this file in a new directory and did a <code>npm install request</code>. The problem went away, I checked from where the <code>byteParsed</code> come from and found it's in "formidable" which is required by express, which I had in the directory where I was running this test. A bit confused right now.</p>