Post request via Chai
<p><br>
I am trying to make a request to my node JS server which accepts post/put call. The parameters I am trying to send with post call via chai is not visible on server (req.body.myparam).<br>
I have tried with below post request but ended with not results:-<br></p>

<pre><code>var host = "http://localhost:3000";
var path = "/myPath";
 chai.request(host).post(path).field('myparam' , 'test').end(function(error, response, body) {
</code></pre>

<p>and </p>

<pre><code>chai.request(host).post(path).send({'myparam' : 'test'}).end(function(error, response, body) {
</code></pre>

<p>Node JS code is given below:-</p>

<pre><code>app.put ('/mypath', function(req, res){                     //Handling post request to create league
    createDoc (req, res);
})


app.post ('/mypath', function(req, res){                        //Handling post request to create league
    createDoc (req, res);
})

var createDoc = function (req, res) {
    var myparam = req.body.myparam;                                 //league id to create new league
    if (!myparam) {
        res.status(400).json({error : 'myparam is missing'});
        return;
    }       
};
</code></pre>

<p>Above code goes to myparam is missing.</p>

<p>Please let me know what is the best way to do the same.<br>
Thanks in Advance.</p>