WebCommitView: Fix Gistie code

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.
This commit is contained in:
Pieter de Bie
2008-10-21 22:24:17 +02:00
parent 9b86f61991
commit 1c7fa93074
+6 -4
View File
@@ -85,12 +85,14 @@ 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');
@@ -98,7 +100,7 @@ var gistie = function() {
try {
t.send(params);
} catch(e) {
notify("Pasting to Gistie failed.", -1);
notify("Pasting to Gistie failed: " + e, -1);
}
}