title: How to get post-data after sending the https.request using Nodejs?
body: <p>I'm trying to get options and post-data of the request object that were added before sending the request</p>
  
  <p>For reports, it would be more useful to use one state of the data that have the results of the request and response</p>
  
  <pre><code>function request(options, postData) {
      const Module = protocol==='https:' ? https : http;
  
      return new Promise((resolve, reject) =&gt; {
          const req = Module.request(options);
          req.on('response', resolve);
          req.on('error', reject);
          postData &amp;&amp; req.write(postData);
          req.end();
      });
  }
  
  const options = { ... };
  const postData = { ... };
  
  request(options, postData)
  .then(response =&gt; {
  
      // How to get this data?
      console.log(response.req.options);
      console.log(response.req.postData);
  
  })
  .catch(console.error);
  
  </code></pre>