feat: implement client-side status code handling

This commit is contained in:
naiba
2025-01-05 23:53:04 +08:00
parent 693db2adef
commit f6683adb70
2 changed files with 65 additions and 27 deletions

View File

@@ -0,0 +1,20 @@
package utils
import "github.com/gin-gonic/gin"
type GinCustomWriter struct {
gin.ResponseWriter
customCode int
}
func NewGinCustomWriter(c *gin.Context, code int) *GinCustomWriter {
return &GinCustomWriter{
ResponseWriter: c.Writer,
customCode: code,
}
}
func (w *GinCustomWriter) WriteHeader(code int) {
w.ResponseWriter.WriteHeader(w.customCode)
}