mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 12:48:14 -05:00
21 lines
369 B
Go
21 lines
369 B
Go
|
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)
|
||
|
}
|