title: Proper request with async/await in Node.JS
body: <p>In my program I make <code>async</code> call for my function from another API module:</p>
  
  <pre><code>var info = await api.MyRequest(value);
  </code></pre>
  
  <p><strong>Module code:</strong></p>
  
  <pre><code>var request = require("request")
  
  module.exports.MyRequest = async function MyRequest(value) {
      var options = {
          uri: "http://some_url",
          method: "GET",
          qs: {  // Query string like ?key=value&amp;...
              key : value
          },
          json: true
      }
  
      try {
          var result = await request(options);
          return result;
      } catch (err) {
          console.error(err);
      }
  }
  </code></pre>
  
  <p>Execution returns immediately, however <code>result</code> and therefore <code>info</code> contains request object and request body - <code>info.body</code> like <code>key=value&amp;...</code>, not required response body.</p>
  
  <p>What I'm doing wrong? How to fix? What is proper <code>request</code> usage with <code>async</code>, or it only works correctly with promises like mentioned here: <a href="https://stackoverflow.com/a/40552394/630169">Why await is not working for node request module</a>? Following article mentioned it is possible: <a href="https://blog.risingstack.com/mastering-async-await-in-nodejs/" rel="noreferrer">Mastering Async Await in Node.js</a>.</p>