Commit 8b527877 authored by vicotor's avatar vicotor

update post

(cherry picked from commit 20a90af6)
parent 0befb680
package utils
import (
"github.com/astaxie/beego/httplib"
log "github.com/sirupsen/logrus"
"bytes"
"net/http"
)
func Post(url string, data []byte) error {
log.WithFields(log.Fields{
"url": url,
"datalen": len(data),
})
_, err := httplib.Post(url).Body(data).Response()
tr := &http.Transport{
DisableKeepAlives: true,
}
client := &http.Client{Transport: tr}
resp, err := client.Post(url, "raw", bytes.NewBuffer(data))
if err != nil {
return err
}
defer resp.Body.Close()
return nil
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment