worker_file_getcookie.sjs 499 B

12345678910111213141516
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. function handleRequest(request, response) {
  4. try {
  5. var cookie = request.getHeader("Cookie");
  6. } catch (e) {
  7. cookie = "EMPTY_COOKIE";
  8. }
  9. // avoid confusing cache behaviors.
  10. response.setHeader("Cache-Control", "no-cache", false);
  11. response.setHeader("Content-type", "text/plain", false);
  12. response.setStatusLine(request.httpVersion, "200", "OK");
  13. response.write(cookie);
  14. }