mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 12:48:14 -05:00
f6683adb70
Some checks failed
Contributors / contributors (push) Waiting to run
Sync / sync-to-jihulab (push) Waiting to run
Run Tests / tests (macos) (push) Waiting to run
Run Tests / tests (ubuntu) (push) Waiting to run
Run Tests / tests (windows) (push) Waiting to run
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
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)
|
|
}
|