Every now and again I find it necessary to set up the request body manually (as opposed to using the [FromBody] tag). In the controller you can read from the request body easily enough:
Testing
How do you test this? Normally I would just create a controller, call the method, and check the result. However, in this case, the request stream exists on the HttpContext, which isn’t intuitive to get at.
Luckily, I googled a bunch and figured it out, so here it is (so I don’t forget as fast / can find it again quickly):