mirror of
https://github.com/yusing/godoxy.git
synced 2026-01-11 21:10:30 +01:00
Refactor ServeHTTP to properly handle response body mutations by: - Using ResponseModifier to capture response before modification - Reading body content and allowing middleware to modify it - Writing modified body back if changed during modification - Ensuring proper order: RequestModifier before, ResponseModifier after next() Previously, httputils.NewModifyResponseWriter did not correctly handle body mutations. The new implementation captures the full response, allows modification via modifyResponse, and properly writes back any changes to the body. Add BodyReader() and SetBody() methods to ResponseModifier to support reading and replacing response body content.