gecko/dom/cache/test/mochitest/vary.sjs
Ehsan Akhgari 85e3790c93 Bug 1153388 - Don't attempt to read a header that may not exist; r=bkelly
getHeader() throws an exception if the header doesn't exist.  The checks
for hasHeader() below should prevent this exception from being raised.
2015-04-11 09:57:57 -04:00

10 lines
300 B
JavaScript

function handleRequest(request, response) {
response.setStatusLine(request.httpVersion, 200, "OK");
var header = "no WhatToVary header";
if (request.hasHeader("WhatToVary")) {
header = request.getHeader("WhatToVary");
response.setHeader("Vary", header);
}
response.write(header);
}