tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

sjs_cache_controle_header.sjs (684B)


      1 /* Any copyright is dedicated to the Public Domain.
      2  * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 /* exported handleRequest */
      5 
      6 "use strict";
      7 
      8 // Simple server that writes a text response displaying the value of the
      9 // cache-control header:
     10 // - if the header is missing, the text will be `cache-control:`
     11 // - if the header is available, the text will be `cache-control:${value}`
     12 function handleRequest(request, response) {
     13   response.setHeader("Content-Type", "text/plain; charset=utf-8", false);
     14   if (request.hasHeader("cache-control")) {
     15     response.write(`cache-control:${request.getHeader("cache-control")}`);
     16   } else {
     17     response.write(`cache-control:`);
     18   }
     19 }