title: Returning a promise from the Unirest client
body: <p>Hi I'm trying to get Unirest to return a promise so that I can create a function, call it from an external process and return the response to the calling process. However, I can't work out how to get the promise to return the response.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>const unirest = require('unirest');
  
  function auth() {
      yield unirest.post('https://xxx.xxx.xxx.xxx/authorize/')
          .headers({'Accept': 'application/json', 'Content-Type': 'application/json'})
          .send({"Username": "user1", "Password": "password"})
          .end().exec();
  }
  auth()
  </code></pre>
  
  <p>However this throws the following error:</p>
  
  <pre><code>yield unirest.post('https://xxx.xxx.xxx.xxx/authorize/')
        ^^^^^^^
  SyntaxError: Unexpected identifier
      at Object.exports.runInThisContext (vm.js:76:16)
      at Module._compile (module.js:528:28)
      at Object.Module._extensions..js (module.js:565:10)
      at Module.load (module.js:473:32)
      at tryModuleLoad (module.js:432:12)
      at Function.Module._load (module.js:424:3)
      at Module.runMain (module.js:590:10)
      at run (bootstrap_node.js:394:7)
      at startup (bootstrap_node.js:149:9)
      at bootstrap_node.js:509:3
  </code></pre>