I use Request and standard Node.js HTTP to write a simple rest service.
Currently, the server-side request handler is as follows:
response.writeHead("400","Nope");
response.end();
And the client-side code is as follows:
request.get(href,handleResponse);
function handleResponse(error,response,body) {
console.log(arguments);
}
response.statusCode 400but erroralways null.
What do I need to do on the server side to get the Request module to recognize that the response is an error?
user1739757
source
share