ALEXKRI.NET
Resume Contact
← Back

Better HTTP/1 connection reuse in Go 1.27

Nice one for anyone writing Go HTTP clients: closing a response body without reading it no longer throws the connection away. 100 sequential HTTP/1 calls went from ~710ms on Go 1.26 to ~150ms on 1.27, because Transport now drains the unread body in the background, up to 50ms or 256KB. Which means you can delete that manual drain helper you copied from Stack Overflow - defer resp.Body.Close() is finally enough.

Read the source ↗