mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-12-01 15:59:01 +08:00
82b74c7940
some basic changes to parse upload url
24 lines
439 B
Go
24 lines
439 B
Go
package util
|
|
|
|
import (
|
|
"code.google.com/p/weed-fs/go/glog"
|
|
"io/ioutil"
|
|
"net/http"
|
|
"net/url"
|
|
)
|
|
|
|
func Post(url string, values url.Values) ([]byte, error) {
|
|
r, err := http.PostForm(url, values)
|
|
if err != nil {
|
|
glog.V(0).Infoln("post to", url, err)
|
|
return nil, err
|
|
}
|
|
defer r.Body.Close()
|
|
b, err := ioutil.ReadAll(r.Body)
|
|
if err != nil {
|
|
glog.V(0).Infoln("read post result from", url, err)
|
|
return nil, err
|
|
}
|
|
return b, nil
|
|
}
|