From 1c7fa930741a56e482f0082068e0af03d42de506 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Tue, 21 Oct 2008 22:24:17 +0200 Subject: [PATCH] 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. --- html/commit.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/html/commit.js b/html/commit.js index 1dcf2e5..98fda71 100644 --- a/html/commit.js +++ b/html/commit.js @@ -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 #" + m[1] + "", 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); } }