Created
August 12, 2013 00:02
-
-
Save OliDM/6207457 to your computer and use it in GitHub Desktop.
// Print out response headers for current URL.
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
// showheaders.js | |
// https://github.com/bgrins/devtools-snippets | |
// Print out response headers for current URL. | |
(function() { | |
var request=new XMLHttpRequest(); | |
request.open('HEAD',window.location,false); | |
request.send(null); | |
var headers = request.getAllResponseHeaders(); | |
var tab = headers.split("\n").map(function(h) { | |
return { "Key": h.split(": ")[0], "Value": h.split(": ")[1] } | |
}).filter(function(h) { return h.Value !== undefined; }); | |
console.group("Request Headers"); | |
console.log(headers); | |
console.table(tab); | |
console.groupEnd("Request Headers"); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment