mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix bug : join post is empty
This commit is contained in:
parent
4194ae33fd
commit
57005ed7f8
|
@ -165,7 +165,7 @@ func (s *RaftServer) Join(peers []string) error {
|
||||||
target := fmt.Sprintf("http://%s/cluster/join", strings.TrimSpace(m))
|
target := fmt.Sprintf("http://%s/cluster/join", strings.TrimSpace(m))
|
||||||
glog.V(0).Infoln("Attempting to connect to:", target)
|
glog.V(0).Infoln("Attempting to connect to:", target)
|
||||||
|
|
||||||
err = postFollowingOneRedirect(target, "application/json", &b)
|
err = postFollowingOneRedirect(target, "application/json", b)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.V(0).Infoln("Post returned error: ", err.Error())
|
glog.V(0).Infoln("Post returned error: ", err.Error())
|
||||||
|
@ -182,9 +182,9 @@ func (s *RaftServer) Join(peers []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// a workaround because http POST following redirection misses request body
|
// a workaround because http POST following redirection misses request body
|
||||||
func postFollowingOneRedirect(target string, contentType string, b *bytes.Buffer) error {
|
func postFollowingOneRedirect(target string, contentType string, b bytes.Buffer) error {
|
||||||
backupReader := bytes.NewReader(b.Bytes())
|
backupReader := bytes.NewReader(b.Bytes())
|
||||||
resp, err := http.Post(target, contentType, b)
|
resp, err := http.Post(target, contentType, &b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue