Wednesday 7 June 2017

node express back to back same POST request

I am using node express API in my application, I am facing below issue for API.

I have API which accept header parameter test and values like 1 to 5. Response is depends on header value, different response for different header parameter value.

Problem : If I am using with Single client (say POSTMAN) it is working fine, but if I am using two POSTMAN with different header parameter say in one window test=2 and another window test=5 and if I send both request one after another then on both POSTMAN window I am getting response whichever I am sending first.

For response after some backend work I am sending response.

Below code I am using..

router.post('/:sample/:temp', function(req, res){
....
                if(obj.st == "acknowledged"){
                      res.write(message);
                  }else if (obj.st == "completed") {
                          res.write(message);
                          res.end();

                  }
}



via Sonu Sen

No comments:

Post a Comment