Как заставить GET запросы работать в Postman и скрипте Google Apps - PullRequest
0 голосов
/ 27 мая 2020

В Postman работает следующее:

GET https://mainnet.incognito.org/fullnode

with Body -> raw of:

{
    "id": 1,
    "jsonrpc": "1.0",
    "method": "getbeaconbeststatedetail",
    "params": []
} 

Следующее не работает в скриптах приложений Google:

function getBeaconState() { 
  const mainnet = "https://mainnet.incognito.org/fullnode";
  var raw = JSON.stringify({ "id": 1,"jsonrpc": "1.0","method": "getbeaconbeststatedetail","params": []});
  var requestOptions = {
  "method": "get",
  "headers": {"Content-Type": "application/json"},
  "body": raw,
  "redirect": "follow"
  };

  var beaconState = UrlFetchApp.fetch(mainnet, requestOptions);  
  Logger.log("I set the beaconState variable.");
}

Выдает ошибку 400, значит, я что-то делаю неправильно, но ковыряние меня не очень далеко.

...