Convert cURL to Google Apps Script
<p>I am trying to convert a cURL command to a Google Apps Script PUT request.
I came up with the below google script but it does not seem to work. When I change the URL of both of these to RequestBin in order to probe what the server side is getting, RequestBin shows that the raw source of both of these come through as exactly the same. Yet, only the cURL command is able to perform the desired action (update a file on github) when I change it back to the github URL.</p>

<pre><code>curl -i -X PUT -H 'Authorization: token yadayda' -d '{"path":"mygeojson.json","message":"Initial Commit","committer":{"name":"Sidd","email":"siddsubra@gmail.com"},"content":"bXkgbmV3IGZpbGUgY29udGVudHM=","sha":"0d5a690c8fad5e605a6e8766295d9d459d65de42","branch":"master"}' https://api.github.com/repos/teku45/GeoJSON-Update/contents/mygeojson.json

cURL Command
</code></pre>

<p>And this is the Google Script</p>

<pre><code>function mainscript() {

  var sha = getSHA();
  var authenticationToken = "yadayada";

  var url = "http://api.github.com/repos/teku45/GeoJSON-Update/contents/mygeojson.json";

  var headers = {
    "Authorization" : "token " + authenticationToken,
  };

  var payload = {  
    "path": "mygeojson.json",
    "message": "Initial Commit",
    "committer":{  
      "name": "Sidd",
      "email": "siddsubra@gmail.com"
    },
    "content": "bXkgbmV3IGZpbGUgY29udGVudHM=",
    "sha": sha,
    "branch": "master"
  };

  var options = {
    "headers" : headers,
    "method" : "PUT",
    "payload" : JSON.stringify(payload)
  };

  Logger.log(options);
  Logger.log(UrlFetchApp.fetch(url, options));
}

Google Apps Script 
</code></pre>