测试代码:
import { serve } from "../deno_std/http/server.ts"; const server = serve({ port: 8000 }); console.log("http://localhost:8000/"); for await (const req of server) { console.log(await req.body.read(1)); req.respond({ body: "Hello World\n" }); }
提交post请求后,调用req.body.read(len)时,会得到下面错误:
error: Uncaught (in promise) TypeError: buf.subarray is not a function
const readBuf = buf.subarray(0, remaining);
^
at Object.read (https://deno.land/std@0.91.0/http/_io.ts:28:1)
搜了一圈好像没找到相关的文档和 issues