title: Using async-await with node-fetch does not return the response to the calling method
body: <p>I have a function defined in a module that is supposed to do a fetch and return the response. I am having trouble returning the response from the fetch. The calling function gets the return value as "undefined".</p>
  
  <p><em>I am new to JavaScript and Node so might need a little bit of hand-holding if you don't mind.</em></p>
  
  <p><strong>Calling function</strong></p>
  
  <pre><code>async function executeTest() {
      try {
          const response = await bpc.postLendingApplication(
              blendConnection,
              loanData
          );
          console.log("Response from POST Loan: ", response);
      } catch (error) {
          console.log(error);
      }
  }
  </code></pre>
  
  <p><strong>Module function doing the fetch request</strong></p>
  
  <pre><code>const fetch = require("node-fetch");
  async function postLendingApplication(connection, data) {
      console.log("Processing POST Loan.");
      await fetch(connection.url, {
          method: "POST",
          headers: connection.headers,
          body: data,
      }).then(async res =&gt; {
          console.log("Status: ", res.status);
          console.log("StatusText: ", res.statusText);
          console.log("OK: ", res.ok);
          return await res;
      });
  }
  </code></pre>
  
  <p><strong>The console output is:</strong></p>
  
  <pre><code>Processing POST Loan.
  Status:  200
  StatusText:  OK
  OK:  true
  Response from POST Loan:  undefined
  </code></pre>
  
  <p>As you can see, the fetch did what it was supposed to do and if I log the res.json() within the module method, it prints the payload. But I would like to return the error and response from the fetch so the module behaves as a generic method and the processing and error handling is done in the calling method.</p>