mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-27 10:47:06 +02:00
fix(middleware): gate only body response modifiers
Replace the rewrite requirement check with a BodyResponseModifier marker and treat header and body modifiers separately. This ensures header/status rewrites still apply when body rewriting is blocked (for binary, encoded, or chunked responses), while body changes are skipped safely. It also avoids body reset/close side effects and returns early on passthrough responses. Update middleware tests to cover split header/body behavior and themed middleware body-skip scenarios.
This commit is contained in:
@@ -122,10 +122,6 @@ func (c *checkBypass) modifyResponse(resp *http.Response) error {
|
||||
return c.modRes.modifyResponse(resp)
|
||||
}
|
||||
|
||||
func (c *checkBypass) requiresBodyRewrite() bool {
|
||||
return requiresBodyRewrite(c.modRes)
|
||||
}
|
||||
|
||||
func (m *Middleware) withCheckBypass() any {
|
||||
if len(m.Bypass) > 0 {
|
||||
modReq, _ := m.impl.(RequestModifier)
|
||||
|
||||
Reference in New Issue
Block a user