Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BodyCaptureWriter ¶
type BodyCaptureWriter struct {
gin.ResponseWriter
Body *bytes.Buffer
}
BodyCaptureWriter is a gin.ResponseWriter that captures the response body while allowing it to be written to the client
func NewBodyCaptureWriter ¶
func NewBodyCaptureWriter(c *gin.Context) *BodyCaptureWriter
NewBodyCaptureWriter creates a new BodyCaptureWriter
func (*BodyCaptureWriter) GetBody ¶
func (w *BodyCaptureWriter) GetBody() string
GetBody returns the captured response body as a string
func (*BodyCaptureWriter) Unwrap ¶ added in v0.34.12
func (w *BodyCaptureWriter) Unwrap() http.ResponseWriter
Unwrap exposes the underlying gin.ResponseWriter so http.ResponseController can reach connection-level controls (SetReadDeadline etc.) through the capture layers. Without it, the double capture the logging + error-handler middlewares install makes every ResponseController feature return ErrNotSupported — silently disarming the upload drain's time bound (the #1608 review's correctness finding 1).
func (*BodyCaptureWriter) Write ¶
func (w *BodyCaptureWriter) Write(b []byte) (int, error)
Write captures the response body and forwards it to the underlying ResponseWriter
func (*BodyCaptureWriter) WriteString ¶
func (w *BodyCaptureWriter) WriteString(s string) (int, error)
WriteString captures the string response and forwards it to the underlying ResponseWriter