title: NodeJS express/request: piping a POST request with body parsing issue
body: <p>I'm trying to pipe a request handling by a remote server, along with the following line:</p>
  
  <p>Unfortunately pipe doesn't work well with post body, could you suggest how can I solve this issue?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>self.downloadPriceLists = function (req, res, next) {
    const options = {
      url: `http://${env.MAILER_HOST}:${env.MAILER_PORT}/getpricelist/`,
      method: 'POST',
      json: true,   // &lt;--Very important!!!
      headers: req.headers,
      headers: {
        'Content-Type': 'application/json;charset=UTF-8',
        "Access-Control-Allow-Origin": "*",
      },
      body: {
        userID: req.user.id,
        exportAsOf: req.body.exportAsOf,
        activationDate: req.body.activationDate,
       },
    };
    console.log("options:", options);
    // remoteResponse :: res
    // remoteBody :: body
    const myReq = request.post(options, function (error, remoteResponse, remoteBody) {
      res.setHeader('Access-Control-Expose-Headers', 'Content-Disposition');
      remoteResponse.headers.hasOwnProperty('content-disposition') &amp;&amp; res.setHeader('Content-disposition', remoteResponse.headers['content-disposition']);
      remoteResponse.headers.hasOwnProperty('content-type') &amp;&amp; res.setHeader('Content-type', remoteResponse.headers['content-type']);
      if (error) {
        console.error('request fail:', error);
        return res.status(500).end('Error');
      }
  
      console.log('submit successful:', remoteResponse.headers);
      res.pipe(remoteBody);
    });
  
  
    // Handle errors
    myReq.on('error', function (err) {
      console.log("++++++++++++sendReq Handle errors:", err);
      res.status(500).end("Error:" + err);
    });
  };</code></pre>
  </div>
  </div>
  </p>