Commit ddd03ae2 authored by vicotor's avatar vicotor

update post

parent e61aef19
package utils package utils
import ( import (
"github.com/astaxie/beego/httplib" "bytes"
"net/http"
) )
func Post(url string, data []byte) error { func Post(url string, data []byte) error {
_, 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 { 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