Commit 8c0165f6 authored by vicotor's avatar vicotor

update post

(cherry picked from commit 20a90af6)
parent 41dd54d8
package utils package utils
import ( import (
"github.com/astaxie/beego/httplib" "bytes"
log "github.com/sirupsen/logrus" "net/http"
) )
func Post(url string, data []byte) error { func Post(url string, data []byte) error {
log.WithFields(log.Fields{ tr := &http.Transport{
"url": url, DisableKeepAlives: true,
"datalen": len(data), }
}) client := &http.Client{Transport: tr}
_, err := httplib.Post(url).Body(data).Response()
resp, err := client.Post(url, "raw", bytes.NewBuffer(data))
if err != nil { if err != nil {
return err return err
} }
defer resp.Body.Close()
return nil 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