GeezerVison is showing github.com — Fix: Only cache on GET requests · nullstack/nullstack@9b4b24e
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: workers/dynamicFetch.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | function dynamicStrategy(event) { |
2 | 2 | event.waitUntil( |
3 | 3 | (async function () { |
| 4 | + if (event.request.method !== 'GET') return |
4 | 5 | const url = new URL(event.request.url) |
5 | 6 | for (const matcher of self.context.worker.staleWhileRevalidate) { |
6 | 7 | if (match(matcher, url)) { |
@@ -13,7 +14,6 @@ function dynamicStrategy(event) { |
13 | 14 | } |
14 | 15 | } |
15 | 16 | if (url.origin !== location.origin) return |
16 | | - if (event.request.method !== 'GET') return |
17 | 17 | if (url.pathname.indexOf('/nullstack/') > -1) { |
18 | 18 | return event.respondWith(networkFirst(event)) |
19 | 19 | } |
|
Collapse file
Copy file name to clipboardExpand all lines: workers/staticFetch.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | function staticStrategy(event) { |
2 | 2 | event.waitUntil( |
3 | 3 | (async function () { |
| 4 | + if (event.request.method !== 'GET') return |
4 | 5 | const url = new URL(event.request.url) |
5 | 6 | for (const matcher of self.context.worker.staleWhileRevalidate) { |
6 | 7 | if (match(matcher, url)) { |
@@ -13,7 +14,6 @@ function staticStrategy(event) { |
13 | 14 | } |
14 | 15 | } |
15 | 16 | if (url.origin !== location.origin) return |
16 | | - if (event.request.method !== 'GET') return |
17 | 17 | if (url.pathname.indexOf('/nullstack/') > -1) { |
18 | 18 | return event.respondWith(networkFirst(event)) |
19 | 19 | } |
|