title: How to upload file using restify
body: <p>I'm trying to upload image file to Rest server(Confluence to be more specific) using Restify module but getting Assertion error. I'm not sure if I'm using right approach for file upload to REST server. Could anyone point me to the right direction?</p>
  
  <p>This is my attempt - </p>
  
  <pre><code>var restify = require('restify');
  var header = {'Authorization': 'Basic xxxxx', 'content-type': 'multipart/form-data'};
  var client = restify.createJsonClient({
     url: 'http://www.testsite.com',
     version: '*',
     headers: header
  });
  var image = "c:\\Users\\abc\\Documents\\bbb.jpg";           
  var fileStream = fs.createReadStream(image);
  var stat = fs.statSync(image);
  var size = stat["size"];
  var param = "?pageId=123&amp;filename=mynewimage&amp;mimeType=image%2Fjpeg&amp;size=" + size;       
  fileStream.pipe(
      client.post("/plugins/drag-and-drop/upload.action"+param, function(err, req, res, obj) {
          if (err) {
              return err;
          }
  
      })
  );  
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p>This is an assertion error I'm getting assert.js:86</p>
  
  <pre>
  throw new assert.AssertionError({
          ^
  AssertionError: body
      at Object.module.exports.(anonymous function) [as ok] (c:\Users\abc\myproj\node_modules\restify\node_modules\assert-pl
  us\assert.js:242:35)
      at JsonClient.write (c:\Users\abc\myproj\node_modules\restify\lib\clients\json_client.js:31:12)
      at ReadStream.ondata (_stream_readable.js:540:20)
      at ReadStream.emit (events.js:107:17)
      at readableAddChunk (_stream_readable.js:163:16)
      at ReadStream.Readable.push (_stream_readable.js:126:10)
      at onread (fs.js:1683:12)
      at FSReqWrap.wrapper [as oncomplete] (fs.js:529:17)
  </pre>