Function body is apparently readablestream?

I have a fetch request like this:

fetch('/.netlify/functions/get-image', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
    },
    body: JSON.stringify({test: 'test'})
})

And a function called get-image.js like this:

export default async (request, context) => {
    console.log(request.body);
}

The request.body is always a ReadableStream instead of JSON. This happens on dev and prod.

I can get it working with await request.json(), but I’m unsure why this is necessary. Am I doing something wrong?

@judeosborncanva See this blog article:

https://www.netlify.com/blog/introducing-netlify-functions-2-0/

It mentions:

Functions are now defined as methods that receive a standard Request and return a standard Response, in line with the Edge Functions API.

It links to this documentation for the standard Request:
https://developer.mozilla.org/en-US/docs/Web/API/Request

If you’re trying to access the JSON then, (as you’ve mentioned), you want:

console.log( await request.json() )

Okay, that explains it. Thanks for the clarification.