Not quite? As far as I can tell, it is detecting it is a Module Syntax Worker, it just complains tha
Not quite? As far as I can tell, it is detecting it is a Module Syntax Worker, it just complains that it doesn’t have any handlers
fetch even if you have export default {}dotenv to be a string of .env.env file.dev.vars[vars] and you upload secrets with wrangler secret putnode:crypto. Which modules do you need?content-disposition header (it looks like you're making the request with the header, which is different)text/plain, in your example I could do a contentType query param of video/webm and the browser would think my text file is a videoexport default {
fetch(req: Request) {
const someHeader = req.headers.get("some-header");
}
}export interface Env {
BUCKET_URL_AUTH_GENERATION_KEY: string;
BUCKET_URL_SYMMETRIC_KEY: string;
}
export default {
async fetch(request: Request, env: Env,): Promise<Response> {
if (!env.BUCKET_URL_AUTH_GENERATION_KEY || !env.BUCKET_URL_SYMMETRIC_KEY) {
return new Response("Missing required environment variables", { status: 500 });
}const newRequest = new Request(request);
const contentType = url.searchParams.get("content-type");
if (contentType) {
newRequest.headers.set("Content-Type", contentType);
}
const contentDisposition = url.searchParams.get("content-disposition");
if (contentDisposition) {
newRequest.headers.set("Content-Disposition", contentDisposition);
}
return fetch(new URL(url.pathname, `https://${requiredHostname}`), newRequest);content-dispositiontext/plaincontentTypevideo/webmconst res = fetch(new URL(url.pathname, `https://${requiredHostname}`));
// Clone the response because it's immutable by default.
const clonedRes = new Response(res.body, res);
clonedRes.headers.set("Content-Disposition", contentDisposition);
clonedRes.headers.set("Content-Type", contentType);
return clonedRes