mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
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:
+6
-4
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user