Commit 98007a22 authored by malkoG's avatar malkoG
Browse files

fix(nestjs): use req.body to avoid undici body lock error

NestJS already consumes the request stream, so wrapping it with
Readable.toWeb(req) caused undici to throw a "body object should not be
disturbed or locked" error. Passing req.body directly fixes this.
parent 125bd990
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -86,9 +86,7 @@ function fromERequest(req: ERequest): Request {
    headers,
    // @ts-ignore: duplex is not supported in Deno, but it is in Node.js
    duplex: "half",
    body: req.method === "GET" || req.method === "HEAD"
      ? undefined
      : (Readable.toWeb(req)),
    body: req.method === "GET" || req.method === "HEAD" ? undefined : req.body,
  });
}