62 Star 374 Fork 119

admpub / nging

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ping.go 504 Bytes
一键复制 编辑 原始数据 按行查看 历史
admpub 提交于 2019-05-11 09:29 . update
package index
import (
"io/ioutil"
"github.com/webx-top/echo"
)
func Ping(ctx echo.Context) error {
header := ctx.Request().Header()
body := ctx.Request().Body()
b, _ := ioutil.ReadAll(body)
body.Close()
r := echo.H{
`header`: header.Object(),
`form`: echo.NewMapx(ctx.Request().Form().All()).AsStore(),
`body`: string(b),
}
data := ctx.Data()
data.SetData(r)
callback := ctx.Form(`callback`)
if len(callback) > 0 {
return ctx.JSONP(callback, data)
}
return ctx.JSON(data)
}
Go
1
https://gitee.com/admpub/nging.git
git@gitee.com:admpub/nging.git
admpub
nging
nging
v2.2.3

搜索帮助