ReadableStream type error

Not sure what I'm doing wrong here, but I'm getting a type error when trying to pass a request body on unchanged in a
fetch
.

Worker code is as follows:
export default {
  async fetch(req: WorkerRequest, _env: unknown, _ctx: WorkerExecutionContext) {
    const init: RequestInit = {
      body: req.body,
      headers: {
        "User-Agent": req.headers.get("User-Agent")!,
      },
      method: 'POST',
    }

    let path = new URL(req.url).pathname
    let address = 'https://pythondiscord.report-uri.com' + path
    let response = await fetch(address, init);

    return new Response(response.body, {
      status: response.status,
      statusText: response.statusText
    })
  }
}


It doesn't like the req.body being passed into the body of the RequestInit for whatever reason
image.png
Was this page helpful?