summaryrefslogtreecommitdiffstats
path: root/netwerk/cookie/test/browser/cookies.sjs
blob: 9beb861d44abf668750f6b94edd65c9d25020e0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function handleRequest(aRequest, aResponse) {
  aResponse.setStatusLine(aRequest.httpVersion, 200);
  let query = new URLSearchParams(aRequest.queryString);

  if (query.has("Set-Cookie")) {
    for (let value of query.getAll("Set-Cookie")) {
      aResponse.setHeader("Set-Cookie", value, true);
    }
    return;
  }

  let cookieStr = "";
  if (aRequest.hasHeader("Cookie")) {
    cookieStr = aRequest.getHeader("Cookie");
  }
  aResponse.write(cookieStr);
}