Skip to content

Commit

Permalink
Implement quick debug link.
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
abourget committed May 10, 2010
1 parent 97fc937 commit 5c49d27
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions simple-rest-client/_locales/en/messages.json
Expand Up @@ -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:"},
Expand Down
1 change: 1 addition & 0 deletions simple-rest-client/_locales/fr/messages.json
Expand Up @@ -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:"},
Expand Down
6 changes: 5 additions & 1 deletion simple-rest-client/index.html
Expand Up @@ -64,6 +64,10 @@ <h1 class="_msg_">name</h1>
<label for="responseHeaders" class="_msg_">headers</label>
<textarea name="responseHeaders" id="responseHeaders" tabindex="6" onkeyup="grow('responseHeaders');"></textarea>
</p>
<p id="debugLinks" style="display: none;">
<label for="debugLink" class="_msg_">debuglink</label>
<a href="" id="debugLink"></a>
</p>
<div id="respData">
<label for="responseData" class="_msg_">data</label>
<div name="responseData" id="responseData" contenteditable="true">
Expand All @@ -80,4 +84,4 @@ <h1 class="_msg_">name</h1>
<script text="text/javascript">
$(":input:first").focus();
</script>
</html>
</html>
5 changes: 5 additions & 0 deletions simple-rest-client/requester.js
Expand Up @@ -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, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'));

$("#respHeaders").css("display", "");
Expand Down

0 comments on commit 5c49d27

Please sign in to comment.