>encodeURIComponent("https://www.google.de") ="https%3A%2F%2Fwww.google.de"
Seems to work fine. Code compiles without any problems.
Latest result:
>var options = url.parse("http://api.telegram.org/bot{MYTOKEN}/getUpdates") ={ protocol: "http:", method: "GET", host: "api.telegram.org", path: "/bot{MYTOKEN}" ... "{MYTOKEN}/getUpdates", pathname: "/bot{MYTOKEN}" ... "{MYTOKEN}/getUpdates", search: null, port: null, query: null } >var request = require("http").request(options, function(res) { : res.on('data', function(data) { : console.log("HTTP> "+data); : }); : res.on('close', function(data) { : console.log("Connection closed"); : }); :}); :request.on('error', (err) => {console.log(err);}); =undefined >request.end() =undefined HTTP> <html> <head> HTTP> <title>301 Moved Permanently</title></head> <body bgcolor="white"> <center><h1>301 Moved Permanently</h1></center> <hr><center>nginx/1.12.2</center> </body> </html> Connection closed
The "301 Moved Permanently" should be a real result of telegram. Why it didn't work in espruino. No issues on browser or on postman.
@Crash started
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.
Seems to work fine.
Code compiles without any problems.
Latest result:
The "301 Moved Permanently" should be a real result of telegram. Why it didn't work in espruino. No issues on browser or on postman.