Browse Source

Adding check for content-type header

Kimbro Staken 12 năm trước cách đây
mục cha
commit
d8d33e8b8b
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 4 2
      api.go

+ 4 - 2
api.go

@@ -555,8 +555,10 @@ func postContainersStart(srv *Server, version float64, w http.ResponseWriter, r
 
 
 	// allow a nil body for backwards compatibility
 	// allow a nil body for backwards compatibility
 	if r.Body != nil {
 	if r.Body != nil {
-		if err := json.NewDecoder(r.Body).Decode(hostConfig); err != nil {
-			return err
+		if r.Header.Get("Content-Type") == "application/json" {
+			if err := json.NewDecoder(r.Body).Decode(hostConfig); err != nil {
+				return err
+			}
 		}
 		}
 	}
 	}