From 5c49d27221b9df1c4e9f6e1c58d9761382523d37 Mon Sep 17 00:00:00 2001 From: Alexandre Bourget Date: Mon, 10 May 2010 13:24:18 -0400 Subject: [PATCH] Implement quick debug link. - Used when you develop with Pylons, as it returns the debugging URL in the headers. Might be of use with other frameworks, directly or with slight modifications. --- simple-rest-client/_locales/en/messages.json | 1 + simple-rest-client/_locales/fr/messages.json | 1 + simple-rest-client/index.html | 6 +++++- simple-rest-client/requester.js | 5 +++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/simple-rest-client/_locales/en/messages.json b/simple-rest-client/_locales/en/messages.json index 8b2f1be7..8b5017f6 100644 --- a/simple-rest-client/_locales/en/messages.json +++ b/simple-rest-client/_locales/en/messages.json @@ -2,6 +2,7 @@ "name": {"message": "Simple REST Client"}, "description": {"message": "Construct custom HTTP requests to directly test your web services."}, "request": {"message": "Request"}, + "debuglink": {"message": "Debug link"}, "url": {"message": "URL:"}, "method": {"message": "Method:"}, "headers": {"message": "Headers:"}, diff --git a/simple-rest-client/_locales/fr/messages.json b/simple-rest-client/_locales/fr/messages.json index 6143d59a..db8dfdee 100644 --- a/simple-rest-client/_locales/fr/messages.json +++ b/simple-rest-client/_locales/fr/messages.json @@ -2,6 +2,7 @@ "name": {"message": "Client REST simple"}, "description": {"message": "Constuisez vos requêtes HTTP pour tester directement vos services web."}, "request": {"message": "Requête"}, + "debuglink": {"message": "Lien de débogage"}, "url": {"message": "URL:"}, "method": {"message": "Méthode:"}, "headers": {"message": "En-têtes:"}, diff --git a/simple-rest-client/index.html b/simple-rest-client/index.html index 57f5a288..e308fa73 100644 --- a/simple-rest-client/index.html +++ b/simple-rest-client/index.html @@ -64,6 +64,10 @@

name

+
@@ -80,4 +84,4 @@

name

- \ No newline at end of file + diff --git a/simple-rest-client/requester.js b/simple-rest-client/requester.js index 7c3b9c06..e94ebdc5 100644 --- a/simple-rest-client/requester.js +++ b/simple-rest-client/requester.js @@ -75,6 +75,11 @@ function readResponse() { } $("#responseStatus").html(this.status); $("#responseHeaders").val(jQuery.trim(this.getAllResponseHeaders())); + var debugurl = /X-Debug-URL: (.*)/i.exec($("#responseHeaders").val()); + if (debugurl) { + $("#debugLink").attr('href', debugurl[1]).html(debugurl[1]); + $("#debugLinks").css("display", ""); + } $("#codeData").html(jQuery.trim(this.responseText).replace(/&/g, '&').replace(//g, '>')); $("#respHeaders").css("display", "");