browser/devtools/webconsole/test/test-bug-599725-response-headers.sjs

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /*
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/publicdomain/zero/1.0/
     4  */
     6 function handleRequest(request, response)
     7 {
     8   var Etag = '"4c881ab-b03-435f0a0f9ef00"';
     9   var IfNoneMatch = request.hasHeader("If-None-Match")
    10                     ? request.getHeader("If-None-Match")
    11                     : "";
    13   var page = "<!DOCTYPE html><html><body><p>hello world!</p></body></html>";
    15   response.setHeader("Etag", Etag, false);
    17   if (IfNoneMatch == Etag) {
    18     response.setStatusLine(request.httpVersion, "304", "Not Modified");
    19   }
    20   else {
    21     response.setHeader("Content-Type", "text/html", false);
    22     response.setHeader("Content-Length", page.length + "", false);
    23     response.write(page);
    24   }
    25 }

mercurial