package main import ( "log" "testing" "github.com/474420502/requests" "github.com/gin-gonic/gin" ) func TestCallback(t *testing.T) { eg := gin.New() eg.POST("/callback", func(c *gin.Context) { if tid, ok := c.GetPostForm("taskid"); ok { log.Println(tid) } }) data := make(map[string]string) data["url"] = "https://playerduo.com/api/playerDuo-service-v2/rip113?lang=en&deviceType=browser" data["callback"] = "http://localhost:4848/callback" go func() { resp, err := requests.NewSession().Post("http://localhost:7123/task/put").SetBodyAuto(data, requests.TypeFormData).Execute() if err != nil { log.Println(err) } else { log.Println(string(resp.Content())) } }() eg.Run(":4848") }