summaryrefslogtreecommitdiff
path: root/cli/bench/http/deno_http_flash_post_bin.js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/bench/http/deno_http_flash_post_bin.js')
-rw-r--r--cli/bench/http/deno_http_flash_post_bin.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/bench/http/deno_http_flash_post_bin.js b/cli/bench/http/deno_http_flash_post_bin.js
new file mode 100644
index 000000000..cea530e60
--- /dev/null
+++ b/cli/bench/http/deno_http_flash_post_bin.js
@@ -0,0 +1,16 @@
+// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
+
+const addr = Deno.args[0] || "127.0.0.1:4500";
+const [hostname, port] = addr.split(":");
+const { serve } = Deno;
+
+async function handler(request) {
+ try {
+ const buffer = await request.arrayBuffer();
+ return new Response(buffer.byteLength);
+ } catch (e) {
+ console.log(e);
+ }
+}
+
+serve(handler, { hostname, port });