std/http: make req.body a Reader#3575
Conversation
|
I like that the API surface has been reduced, but using it is more convoluted now and there are many new ways to screw it up. It is not at all obvious what the buffer length should be and having to create it manually is annoying. It's a lot more lines (comparatively). We have to use a I am skeptical of the "do everything like Go" philosophy. The consistency is nice and Go's APIs are generally nice. But this is not Go. We should use the best facilities available to us that express the intent. Doesn't an async generator fit the bill better? At least it's what most people would prefer to interact with, I think. |
|
|
Follow-up and partially based on #3553
req.bodyis now aReader. This should now be closer to the behavior of Go.req.bodyStream()is also tweaked and no longer exposed to public.Also add
req.contentLength. It is also a field exposed in Go'sRequeststruct.