fix(response): refine hijack behavior for response lifecycle (#4373)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* feat: refine hijack behavior for response lifecycle and add tests - Clarify the error message for attempted hijack after response body data is written - Modify hijack behavior: allow hijacking after headers are written (for better websocket compatibility), but block hijacking after any body data is sent - Add comprehensive tests to validate allowed hijack after header write and disallowed hijack after body write fix https://github.com/gin-gonic/gin/issues/4372 Signed-off-by: appleboy <appleboy.tw@gmail.com> * test: use require for immediate test failure on errors - Replace assert with require for error checks to ensure test failures immediately halt execution Signed-off-by: appleboy <appleboy.tw@gmail.com> * Update response_writer.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> ---------
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Diff stats
2 files+62 added−2 removed
- other:+62 added−2 removed