2

I am making a simple request to my Node.js API. I am returning 400 as the status code and a custom message in the send method. For some odd reason all that is returned is a Bad Request text in the body not the custom message. Not sure what I am doing wrong. This works fine in development environment but not in staging environment.

Simply

res.status(400);
res;
res.send('You already are joined');
DrCord
  • 3,917
  • 3
  • 34
  • 47
user516883
  • 8,868
  • 23
  • 72
  • 114
  • try this `res.status(400).end('You already joined');` – deowk May 08 '15 at 21:25
  • @deolectrix that did not work. Still "Bad Request" in body. – user516883 May 08 '15 at 21:28
  • Is the server behind any load-balancers/nginx? – Alex Alksne May 08 '15 at 21:31
  • No the server is being hosted by Azure. – user516883 May 08 '15 at 21:32
  • What is your development environment where it works? What is different between the development and staging environments? – DrCord May 08 '15 at 21:36
  • @DrCord development box is my local machine (Mac) and staging is a normal iis server. All 200 request works fine in both environments. Something about 400 not allowing custom messages. – user516883 May 08 '15 at 21:39
  • 1
    I would examine the differences in your environments. The dev is a mac the other is a windows server... – DrCord May 08 '15 at 21:40
  • iis requires a web.config file to run. The answer adding the following tag to your config file. Answer is here. http://stackoverflow.com/questions/15144405/windows-azure-websites-is-overriding-my-404-and-500-error-pages-in-my-node-js-ap – user516883 May 08 '15 at 22:27

0 Answers0