Last active
June 2, 2021 15:36
-
-
Save kt3k/df0b55513544a006ec5db08b20de2c6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener("fetch", (e) => { | |
e.respondWith((async () => { | |
let result: string; | |
const { request } = e; | |
if (request.body == null) { | |
result = "request body is empty\n"; | |
} else { | |
result = `request body length = ${(await request.arrayBuffer()).byteLength}\n`; | |
} | |
return new Response(result) | |
})()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment