Skip to content

Commit

Permalink
WebCommitView: Fix Gistie code
Browse files Browse the repository at this point in the history
After removing the prototype code, the Gistie XMLHTTPRequest would send
the complete request in the URI, which was often too lang and cause a
failure.

This only sends the request in the body, and also adds additional
diagnostics.
  • Loading branch information
pieter committed Oct 21, 2008
1 parent 9b86f61 commit 1c7fa93
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions html/commit.js
Expand Up @@ -85,20 +85,22 @@ var gistie = function() {
if (t.readyState == 4 && t.status >= 200 && t.status < 300) {
if (m = t.responseText.match(/gist: ([a-f0-9]+)/))
notify("Code uploaded to gistie <a target='_new' href='http://gist.github.com/" + m[1] + "'>#" + m[1] + "</a>", 1);
else
notify("Pasting to Gistie failed.", -1);
else {
notify("Pasting to Gistie failed :(.", -1);
Controller.log_(t.responseText);
}
}
}

t.open('POST', "http://gist.github.com/gists?" + params);
t.open('POST', "http://gist.github.com/gists");
t.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
t.setRequestHeader('Accept', 'text/javascript, text/html, application/xml, text/xml, */*');
t.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;charset=UTF-8');

try {
t.send(params);
} catch(e) {
notify("Pasting to Gistie failed.", -1);
notify("Pasting to Gistie failed: " + e, -1);
}
}

Expand Down

0 comments on commit 1c7fa93

Please sign in to comment.