123456789101112131415161718192021222324252627 |
- package main
- import (
- "github.com/gin-gonic/gin"
- "net/http"
- "runtime"
- )
- func main() {
- runtime.GOMAXPROCS(-1)
- router := gin.New()
- router.POST("", reply)
- router.GET("", reply)
- _ = router.Run(":9090")
- }
- func reply(ctxt *gin.Context) {
- println("url", ctxt.Request.URL.String())
- sign := ctxt.GetHeader("X-Gogs-Signature")
- println("X-Gogs-Signature", sign)
- buf := make([]byte, 10240)
- n, _ := ctxt.Request.Body.Read(buf)
- println(string(buf[0:n]))
- ctxt.JSON(http.StatusOK, "OK")
- }
|