init cf worker code

This commit is contained in:
etfans
2023-05-28 00:54:56 +08:00
parent 04e25f5130
commit b7e037de56
20 changed files with 18244 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
export default {
/**
* @param {import("@cloudflare/workers-types").Request} request
* @param {{uuid: string}} env
* @param {import("@cloudflare/workers-types").ExecutionContext} ctx
* @returns {Promise<Response>}
*/
async fetch(request, env, ctx) {
const headers = {};
for (const [name, value] of request.headers.entries()) {
headers[name] = value;
}
const result = {
"http-header": headers,
"cf": request.cf
}
const headersJson = JSON.stringify(result);
console.log(headersJson);
return new Response(headersJson, { status: 200 });
}
};