title: How to create and manipulate promises in Protractor?
body: <p>I want to use the Node Http module to call my server directly in order to set up my Protractor tests. Http is callback based and I want to turn that into promises.</p>
  
  <p>For example, I want to have this function return promise:</p>
  
  <pre><code>function callMyApi() {
    var promise = // somehow create promise;
  
    http.request({path: '/yada/yada', method: 'POST'}, function(resp) {
      promise.complete(resp);
    });
  
    return promise;
  }
  </code></pre>
  
  <p>So, the question is: what do I need to <code>require()</code> and put in place of "somehow create promise" for this to work?</p>