Comment

Comment by hnav

It drains up to 256K unread bytes period, it doesn't just optimize the case of the body not being read at all.

https://cs.opensource.google/go/go/+/refs/tags/go1.27.2:src/...

What it won't do looking at the code is handle streamed responses over transfer-encoding:chunked which means that if the other end is doing

  json.NewEncoder(responseWriter).Encode(&someStruct)
this optimization won't do anything.
parent hnav 17 days ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton