Ups. I forgot to call req.end() when I created the test code for the GET request. I'm sorry for the confusion. So the following is working too now:
var options = { host: "http://www.google.com" };
var req = require("http").request(options, function(res) {
console.log("status: " + res.statusCode);
});
req.end(); // <=== was missing
But I still have some issues with the post call not ending. I think its because of the Mandrill API. The following sample code (POST req. to Requestbin) is working. The console prints the status code (200) after the request:
But when I do the same for the Mandrill API then the post request is not ending. Mandrill gets the request successfully but its seems that the Espruino is still waiting for a response:
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Ups. I forgot to call
req.end()
when I created the test code for the GET request. I'm sorry for the confusion. So the following is working too now:But I still have some issues with the post call not ending. I think its because of the Mandrill API. The following sample code (POST req. to Requestbin) is working. The console prints the status code (200) after the request:
But when I do the same for the Mandrill API then the post request is not ending. Mandrill gets the request successfully but its seems that the Espruino is still waiting for a response:
I will try to investigate further. The same request (http & https) using a rest-client (Postman) is working correctly.