How to Access Posted Data in Netlify Edge Function

When using netlify edge functions I can’t access the posted data.

For example, from the front end we post this code:

fetch('/foo', {
  method: 'POST',
  body: JSON.stringify({ foo: 'bar' })
})
.then(res => res.json())
.then(data => console.log(data))

The in our netlify.toml

[[edge_functions]]
  path = "/foo"
  function = "foo"

and in our edge function foo.js

export default async (request, context) => {
  console.log(request)
  return Response.json({ msg: "Hello, World from the edge!" }, {
    headers: { 
      'Content-Type': 'application/json',
      'Access-Control-Allow-Origin': '*'
    }
  })
}

If I console.log(request.body) I get [foo] ReadableStream { locked: false }

How can we access the posted data from within the netlify edge function? I looked all over and there is no information on this.

console.log(request) outputs the following object:

[foo] EdgeRequest {
  bodyUsed: false,
  headers: Headers {
    accept: "*/*",
    "accept-encoding": "gzip, deflate, br",
    "accept-language": "en-US,en;q=0.9",
    "cache-control": "no-cache",
    connection: "close",
    "content-length": "16",
    "content-type": "text/plain;charset=UTF-8",
    cookie: "_ga=GA1.1.1939799698.1701538319; _gcl_au=1.1.1892117818.1701538319; _ga_E63KG40SSM=GS1.1.1701736526."... 132 more characters,
    host: "localhost:8888",
    origin: "http://localhost:8888",
    pragma: "no-cache",
    referer: "http://localhost:8888/",
    "sec-ch-ua": '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": '"macOS"',
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin",
    "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0."... 17 more characters,
    "x-forwarded-for": "::1",
    "x-nf-blobs-info": "eyJ1cmwiOiJodHRwOi8vbG9jYWxob3N0OjU4NjU4IiwidG9rZW4iOiJiMGJiNThmNy1hN2I1LTQxZWYtODhkNS00N2QzNmQ4ZTEz"... 8 more characters,
    "x-nf-deploy-id": "0",
    "x-nf-request-id": "01HHQQQAD0S41ZV5EFJ06QE20F"
  },
  method: "POST",
  redirect: "follow",
  url: "http://localhost:8888/foo"
}