mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-29 05:49:03 +08:00
24 lines
399 B
Go
24 lines
399 B
Go
package util
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"log"
|
|
"net/http"
|
|
"net/url"
|
|
)
|
|
|
|
func Post(url string, values url.Values) ([]byte, error) {
|
|
r, err := http.PostForm(url, values)
|
|
if err != nil {
|
|
log.Println("post to", url, err)
|
|
return nil, err
|
|
}
|
|
defer r.Body.Close()
|
|
b, err := ioutil.ReadAll(r.Body)
|
|
if err != nil {
|
|
log.Println("read post result from", url, err)
|
|
return nil, err
|
|
}
|
|
return b, nil
|
|
}
|