mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
bugfix: adjust or add close request body.
affected modules: - lease/leasehttp - contrib/raftexample
This commit is contained in:
parent
6da17cda18
commit
e46af034df
@ -31,6 +31,7 @@ type httpKVAPI struct {
|
||||
|
||||
func (h *httpKVAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
key := r.RequestURI
|
||||
defer r.Body.Close()
|
||||
switch {
|
||||
case r.Method == "PUT":
|
||||
v, err := ioutil.ReadAll(r.Body)
|
||||
|
@ -52,6 +52,7 @@ func (h *leaseHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
defer r.Body.Close()
|
||||
b, err := ioutil.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
http.Error(w, "error reading body", http.StatusBadRequest)
|
||||
|
Loading…
x
Reference in New Issue
Block a user