소스 검색

etcdserver/api/rafthttp: fix the location of close http body.

johncming 7 년 전
부모
커밋
bd41f74168
1개의 변경된 파일과 1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      etcdserver/api/rafthttp/pipeline.go

+ 1 - 1
etcdserver/api/rafthttp/pipeline.go

@@ -155,12 +155,12 @@ func (p *pipeline) post(data []byte) (err error) {
 		p.picker.unreachable(u)
 		return err
 	}
+	defer resp.Body.Close()
 	b, err := ioutil.ReadAll(resp.Body)
 	if err != nil {
 		p.picker.unreachable(u)
 		return err
 	}
-	resp.Body.Close()
 
 	err = checkPostResponse(resp, b, req, p.peerID)
 	if err != nil {