Skip to content

Commit

Permalink
Project update. [p][robotic]
Browse files Browse the repository at this point in the history
  • Loading branch information
jaswrks committed Dec 3, 2023
1 parent a6bbb11 commit e32fd06
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 72 deletions.
130 changes: 65 additions & 65 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.0.125",
"version": "1.0.126",
"license": "GPL-3.0-or-later",
"name": "@clevercanyon/utilities.cfw",
"description": "Utilities for JavaScript apps running in a Cloudflare Worker environment.",
Expand Down Expand Up @@ -54,14 +54,14 @@
},
"dependencies": {},
"peerDependencies": {
"@clevercanyon/utilities": "^1.0.501",
"@clevercanyon/utilities": "^1.0.503",
"@cloudflare/kv-asset-handler": "0.2.0"
},
"peerDependenciesMeta": {},
"optionalDependencies": {},
"bundleDependencies": [],
"devDependencies": {
"@clevercanyon/dev-deps": "^1.0.285"
"@clevercanyon/dev-deps": "^1.0.287"
},
"overrides": {},
"cpu": ["x64", "arm64"],
Expand Down
13 changes: 9 additions & 4 deletions src/cfw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,15 @@ export const handleFetchCache = async (route: Route, feData: FetchEventData): Pr
}
const response = await route(feData);

if ('GET' === request.method && 206 !== response.status && '*' !== response.headers.get('vary')) {
// Cloudflare will not actually cache if response headers say not to cache.
// For further details regarding `cache.put()`; {@see https://o5p.me/gMv7W2}.
ctx.waitUntil(cache.put(request, response.clone()));
if ('GET' === request.method && 206 !== response.status && '*' !== response.headers.get('vary') && !response.webSocket) {
if ($env.isCFWViaMiniflare() && 'no-store' === response.headers.get('cdn-cache-control')) {
// Miniflare doesn’t currently support `cdn-cache-control`, so we implement basic support for it here.
response.headers.set('cf-cache-status', 'miniflare.cdn-cache-control.BYPASS');
} else {
// Cloudflare will not actually cache if response headers say not to cache.
// For further details regarding `cache.put()`; {@see https://o5p.me/gMv7W2}.
ctx.waitUntil(cache.put(request, response.clone()));
}
}
return response;
};
Expand Down

0 comments on commit e32fd06

Please sign in to comment.