You are reading a single comment by @Crash and its replies. Click here to read the full conversation.
  • >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.

About

Avatar for Crash @Crash started