• Yeah that works no problem, after I added custom header support ;)

    I̶t̶ ̶s̶h̶o̶u̶l̶d̶ ̶w̶o̶r̶k̶ ̶w̶i̶t̶h̶ ̶h̶t̶t̶p̶.̶r̶e̶q̶u̶e̶s̶t̶ ̶b̶u̶t̶ ̶I̶ ̶c̶a̶n̶'̶t̶ ̶g̶e̶t̶ ̶a̶n̶y̶ ̶f̶o̶r̶m̶ ̶o̶f̶ ̶t̶h̶a̶t̶ ̶t̶o̶ ̶w̶o̶r̶k̶,̶ ̶e̶v̶e̶n̶ ̶i̶f̶ ̶t̶h̶e̶r̶e̶ ̶i̶s̶n̶'̶t̶ ̶a̶n̶y̶ ̶c̶u̶s̶t̶o̶m̶ ̶h̶e̶a̶d̶e̶r̶s̶.̶

    And ready for Espruino here you go:

    var options = {
      host: 'httptohttps.xyz',
      path: '/https://api.fencer.io/v1.0/geofence',
      method: 'GET',
      headers: { "Authorization" : "YOUR-KEY-HERE" }
    };
    require("http").get(options, function(res) {
      var contents="";
      res.on('data', function(data) {
        console.log(data);
      });
      res.on('close', function(data) {
        console.log("Connection closed");
      });
    });
    

    Something strange happens if I try add data to contents though, it just returns false, that's why I thought I couldn't get it to work.

About

Avatar for MrTimcakes @MrTimcakes started