1 Star 0 Fork 0

Souki/go-framework

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
server_http_handler.go 588 Bytes
一键复制 编辑 原始数据 按行查看 历史
sage 提交于 2022-11-29 10:37 +08:00 . support gin router
package httpserver
import (
"github.com/gin-gonic/gin"
"net/http"
)
//GinHandle 支持转换为gin框架的hanler
func GinHandle(f func(ctx *Ctx)) func(c *gin.Context) {
return func(c *gin.Context) {
ctx := NewCtx(c.Writer, c.Request)
ctx.setGin(c)
f(ctx)
}
}
//EmptyHandle 空处理
func EmptyHandle(ctx *Ctx) {
ctx.writer.WriteHeader(http.StatusNoContent)
return
}
var EmptyHandler = new(emptyHandler)
//空处理器
type emptyHandler int
func (h *emptyHandler) ServeHTTP(w http.ResponseWriter, request *http.Request) {
w.WriteHeader(http.StatusNoContent)
return
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/scottq/go-framework.git
git@gitee.com:scottq/go-framework.git
scottq
go-framework
go-framework
v1.1.46

搜索帮助