mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 12:40:07 +00:00
feat: implement client-side status code handling
This commit is contained in:
20
pkg/utils/gin_writer_wrapper.go
Normal file
20
pkg/utils/gin_writer_wrapper.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user