这是一个用于测试的demo项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
618 B

package main
import (
"encoding/json"
"fmt"
"net/http"
"github.com/gin-gonic/gin"
)
func main(){
engine := gin.Default()
type pushevent map[string]interface{}
engine.POST("/api/v1/webhook", func(c *gin.Context) {
secret := c.GetHeader("X-Hub-Signature")
fmt.Println("secret: ", secret)
event := make(pushevent)
err := c.Bind(&event)
if err != nil {
fmt.Println(err)
}
data, err := json.MarshalIndent(event, "", " ")
if err != nil {
fmt.Println(err)
}
fmt.Println(string(data))
c.String(http.StatusOK, "")
})
err := engine.Run("0.0.0.0:8888")
if err != nil {
panic(err)
}
}