summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fetch/http-cache/post-patch.any.js
blob: 0a69baa5c6646c53397618a8f6810ba7f703ef91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// META: global=window,worker
// META: title=HTTP Cache - Caching POST and PATCH responses
// META: timeout=long
// META: script=/common/utils.js
// META: script=/common/get-host-info.sub.js
// META: script=http-cache.js

var tests = [
  {
    name: "HTTP cache uses content after PATCH request with response containing Content-Location and cache-allowing header",
    requests: [
      {
        request_method: "PATCH",
        request_body: "abc",
        response_status: [200, "OK"],
        response_headers: [
          ['Cache-Control', "private, max-age=1000"],
          ['Content-Location', ""]
        ],
        response_body: "abc"
      },
      {
        expected_type: "cached"
      }
    ]
  },
  {
    name: "HTTP cache uses content after POST request with response containing Content-Location and cache-allowing header",
    requests: [
      {
        request_method: "POST",
        request_body: "abc",
        response_status: [200, "OK"],
        response_headers: [
          ['Cache-Control', "private, max-age=1000"],
          ['Content-Location', ""]
        ],
        response_body: "abc"
      },
      {
        expected_type: "cached"
      }
    ]
  }
];
run_tests(tests);