feat: complete API-driven projects with infrastructure and business acceptance

This commit is contained in:
2026-09-23 17:33:50 +08:00
parent 04a1f7999d
commit 2c74dc0859
137 changed files with 11926 additions and 105 deletions

View File

@@ -481,7 +481,17 @@ func (s *Server) serveConnection(baseCtx context.Context, state *connection) {
disconnectWatch = newClientDisconnectWatch(reader, state.conn, cancel)
}
handler.ServeHTTP(writer, request)
bodyErr := request.Body.Close()
var bodyErr error
if body, ok := request.Body.(*requestBody); ok && !body.done && body.err == nil && writer.status == http.StatusRequestEntityTooLarge {
// An application can reject size from the headers alone when its
// body limit is below the transport limit. Waiting to
// drain a slow or absent body would withhold the rejection response.
// Abandon it and close; unread bytes can never become a next request.
body.closed = true
closeAfter = true
} else {
bodyErr = request.Body.Close()
}
if disconnectWatch != nil {
disconnectWatch.stop()
}