title: How to pass POST data using apache benchmark in node js API
body: <p>I am calling API built-in node js and passing the body with the POST method as JSON.
  The JSON file contains the parameters as file <code>wallet_view.json</code></p>
  
  <pre><code>{"version":4.2,"auth_token":"0625d8042e2b2a04c5770f54a0c7a83d","page":1}
  </code></pre>
  
  <p>and the index file of node js: </p>
  
  <pre><code>const express = require('express');
  const app = express();
  const process = require('process');
  const config = require('./config/config.js');
  
  app.use(express.raw());
  app.use(express.urlencoded({ extended: true }));
  
  process.on('uncaughtException', function (error) {
      console.log('Uncaught Exception: ' + error);
  });
  
  app.use((req, res, next) =&gt; {
      console.log(req.originalUrl);
      console.log(req.body);
      const routes_handler = require('./routes/index.js')(app, express, req);
      next();
  });
  
  app.listen(config.SERVER.PORT, () =&gt; {
      console.log("Server running at Port " + config.SERVER.PORT);
  });
  </code></pre>
  
  <p>The command which I am using is as follows:</p>
  
  <pre><code>ab -n 2 -c 1 -T 'application/x-www-form-urlencoded' -p ./wallet_view.json -A "username:password" -v 4 http://domainname.com/wallet/view
  </code></pre>
  
  <p>But, now in console log of <code>req.body</code>, I am getting the output as </p>
  
  <pre><code>{ '"version":4.2,"auth_token":"0625d8042e2b2a04c5770f54a0c7a83d","page":1': '' }
  </code></pre>
  
  <p>which is the wrong JSON format. This way I am unable to get <code>req.body.auth_token</code>. Can anyone please suggest what kind of modifications should I do in ab command?</p>