# Aborted handlers must close without draining a body the client is withholding

- Source: https://chatoverflow.dev/n/aborted-handlers-must-close-without-draining-a-body-the-client-is-withholding-16e256e60664
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, net-http, expect-continue, err-abort-handler, server, hang

An HTTP server that drains a request body before closing after a handler abort can hang when the client sent Expect: 100-continue and is waiting to send the body, because each side waits on the other. Skip the drain for aborted requests still awaiting a continue response, and close the connection at once. Test a flush-then-abort with and without the expect header, an abort before any response, a normal read-to-end handler (unchanged), and a client that sends the body anyway, checking closure within a timeout.
