forked from ganoro/chrome-rest-sniffer
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Roy Ganor
authored and
Roy Ganor
committed
Jun 11, 2012
1 parent
fd16022
commit 6514fcb
Showing
10 changed files
with
1,311 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Insert title here</title> | ||
<script type="text/javascript" src="lib/devtools.js"></script> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,35 @@ | ||
|
||
|
||
chrome.webRequest.onBeforeSendHeaders.addListener(function(details) { | ||
if (isRestRequest(details.url)) { | ||
var u = details.url.split('/'); | ||
var r = new Request({ | ||
id : details.requestId, | ||
url : details.url, | ||
method : details.method, | ||
name : u[u.length - 1], | ||
headers : details.requestHeaders, | ||
parameters : getParams(details) | ||
}); | ||
console.log(r); | ||
} | ||
return { | ||
requestHeaders : details.requestHeaders | ||
}; | ||
}, { | ||
urls : [ "<all_urls>" ] | ||
}, [ "requestHeaders" ]); | ||
|
||
chrome.webRequest.onCompleted.addListener(function(details) { | ||
if (details.url.indexOf("://www.managekit.net/crm/managekit/rest") != -1) { | ||
alert(details.url); | ||
if (isRestRequest(details.url)) { | ||
var r = new Response({ | ||
requestId : details.requestId, | ||
parameters : getParams(details), | ||
headers : details.responseHeaders | ||
}); | ||
console.log(r); | ||
} | ||
}, { | ||
urls : [ "<all_urls>" ] | ||
}); | ||
}, [ "responseHeaders" ]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
chrome.devtools.panels.create("API Sniffer", "images/logo.png", "panel.html", | ||
function(panel) { | ||
console.log(panel); | ||
}); | ||
|
||
var Session = Backbone.Model.extend({ | ||
defaults : { | ||
"id" : "1", | ||
"name" : "name", | ||
"url" : "http://sohoos.com", | ||
"method" : "GET", | ||
"req_parameters" : [], | ||
"req_headers" : [], | ||
"res_parameters" : [], | ||
"res_headers" : [] | ||
} | ||
}); | ||
|
||
var Sessions = Backbone.Collection.extend({ | ||
model : Session | ||
}); | ||
|
||
collection = new Sessions; | ||
|
||
SearchView = Backbone.View.extend({ | ||
initialize : function() { | ||
this.render(); | ||
}, | ||
render : function() { | ||
var template = _.template($("#request_template").html(), {}); | ||
this.el.html(template); | ||
} | ||
}); | ||
|
||
chrome.devtools.network.onRequestFinished.addListener(function(request) { | ||
console.log(request.request.url); | ||
}); | ||
|
||
|
Oops, something went wrong.