Created
October 27, 2012 13:22
-
-
Save sramam/3964600 to your computer and use it in GitHub Desktop.
Http headers - lowercase to Http-Headercase maps. Useful to map headers from node.js to other servers.
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
// Http Headers listed at http://en.wikipedia.org/wiki/List_of_HTTP_header_fields | |
var http_headers = ["Accept", | |
"Accept-Charset", | |
"Accept-Encoding", | |
"Accept-Language", | |
"Accept-Datetime", | |
"Authorization", | |
"Cache-Control", | |
"Connection", | |
"Cookie", | |
"Content-Length", | |
"Content-MD5", | |
"Content-Type", | |
"Date", | |
"Expect", | |
"From", | |
"Host", | |
"If-Match", | |
"If-Modified-Since", | |
"If-None-Match", | |
"If-Range", | |
"If-Unmodified-Since", | |
"Max-Forwards", | |
"Pragma", | |
"Proxy-Authorization", | |
"Range", | |
"Referer", | |
"TE", | |
"Upgrade", | |
"User-Agent", | |
"Via", | |
"Warning", | |
"X-Requested-With", | |
"DNT", | |
"X-Forwarded-For", | |
"X-Forwarded-Proto", | |
"Front-End-Https", | |
"X-ATT-DeviceId", | |
"X-Wap-Profile", | |
"Proxy-Connection", | |
"Access-Control-Allow-Origin", | |
"Accept-Ranges", | |
"Age", | |
"Allow", | |
"Cache-Control", | |
"Connection", | |
"Content-Encoding", | |
"Content-Language", | |
"Content-Length", | |
"Content-Location", | |
"Content-MD5", | |
"Content-Disposition", | |
"Content-Range", | |
"Content-Type", | |
"Date", | |
"ETag", | |
"Expires", | |
"Last-Modified", | |
"Link", | |
"Location", | |
"P3P", | |
"Pragma", | |
"Proxy-Authenticate", | |
"Refresh", | |
"Retry-After", | |
"Server", | |
"Set-Cookie", | |
"Strict-Transport-Security", | |
"Trailer", | |
"Transfer-Encoding", | |
"Vary", | |
"Via", | |
"Warning", | |
"WWW-Authenticate", | |
"X-Frame-Options", | |
"X-XSS-Protection", | |
"X-Content-Type-Options", | |
"X-Powered-By", | |
"X-UA-Compatible"] | |
function header_map() { | |
var hmap = {} | |
for(var idx in http_headers) { | |
var h = http_headers[idx].substr(0).toLowerCase() | |
hmap[h] = http_headers[idx] | |
} | |
return JSON.stringify(hmap) | |
} | |
header_map() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment