mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-07 14:58:23 +08:00
Service layer writes a complete JSON error response then returns error. Handler's ensureForwardErrorResponse couldn't distinguish this from "no response written" and appended an SSE event, corrupting the body. Use gin.Context flag: service marks MarkResponseCommitted(c) after writing, ensureForwardErrorResponse checks IsResponseCommitted(c) and skips. Zero function signature changes, zero error wrapping.