Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly check URL pathname with Cloudflare adapter #8733

Merged
merged 11 commits into from
Jan 30, 2023
Prev Previous commit
Next Next commit
correctly add placeholders.ts to tsconfig.json
  • Loading branch information
eltigerchino committed Jan 26, 2023
commit 030e05a4208c57f38d2b61807c8ac4eeff6c8ba5
2 changes: 2 additions & 0 deletions packages/adapter-cloudflare/src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const app_path = `/${manifest.appPath}/`;
/** @type {import('worktop/cfw').Module.Worker<{ ASSETS: import('worktop/cfw.durable').Durable.Object }>} */
const worker = {
async fetch(req, env, context) {
// @ts-ignore
await server.init({ env });
// skip cache if "cache-control: no-cache" in request
let pragma = req.headers.get('cache-control') || '';
Expand Down Expand Up @@ -60,6 +61,7 @@ const worker = {
} else {
// dynamically-generated pages
res = await server.respond(req, {
// @ts-ignore
platform: { env, context, caches },
getClientAddress() {
return req.headers.get('cf-connecting-ip');
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-cloudflare/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"@sveltejs/kit": ["../kit/types/index"]
}
},
"include": ["index.js", "placeholders.ts", "src/worker.ts"]
"include": ["index.js", "placeholders.ts", "src/worker.js"]
}