title: Sending HTTP/2 POST request NodeJS
body: <p>I'm trying to figure out how to send an HTTP/2 POST request with NodeJS. I have so far from the example in the documentation:</p>
  
  <pre><code>const http2 = require('http2');
  const fs = require('fs');
  const client = http2.connect('https://localhost:8443', {
    ca: fs.readFileSync('localhost-cert.pem')
  });
  client.on('error', (err) =&gt; console.error(err));
  client.on('socketError', (err) =&gt; console.error(err));
  
  const req = client.request({ ':path': '/' });
  
  req.on('response', (headers, flags) =&gt; {
    for (const name in headers) {
      console.log(`${name}: ${headers[name]}`);
    }
  });
  
  req.setEncoding('utf8');
  let data = '';
  req.on('data', (chunk) =&gt; { data += chunk; });
  req.on('end', () =&gt; {
    console.log(`\n${data}`);
    client.close();
  });
  req.end();
  </code></pre>
  
  <p>But there it isn't clear to me how to actually setup data to send as a POST.</p>