1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/webconsole/test/test-bug-599725-response-headers.sjs Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,25 @@ 1.4 +/* 1.5 + * Any copyright is dedicated to the Public Domain. 1.6 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.7 + */ 1.8 + 1.9 +function handleRequest(request, response) 1.10 +{ 1.11 + var Etag = '"4c881ab-b03-435f0a0f9ef00"'; 1.12 + var IfNoneMatch = request.hasHeader("If-None-Match") 1.13 + ? request.getHeader("If-None-Match") 1.14 + : ""; 1.15 + 1.16 + var page = "<!DOCTYPE html><html><body><p>hello world!</p></body></html>"; 1.17 + 1.18 + response.setHeader("Etag", Etag, false); 1.19 + 1.20 + if (IfNoneMatch == Etag) { 1.21 + response.setStatusLine(request.httpVersion, "304", "Not Modified"); 1.22 + } 1.23 + else { 1.24 + response.setHeader("Content-Type", "text/html", false); 1.25 + response.setHeader("Content-Length", page.length + "", false); 1.26 + response.write(page); 1.27 + } 1.28 +}