mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
write headers after error checking
This commit is contained in:
parent
979f832a0c
commit
865ba190ff
@ -84,7 +84,6 @@ func (s *KubeletServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
fmt.Fprint(w, "{}")
|
fmt.Fprint(w, "{}")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.Header().Add("Content-type", "application/json")
|
|
||||||
encoder := json.NewEncoder(w)
|
encoder := json.NewEncoder(w)
|
||||||
err = encoder.Encode(stats)
|
err = encoder.Encode(stats)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -93,6 +92,7 @@ func (s *KubeletServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
|
w.Header().Add("Content-type", "application/json")
|
||||||
case u.Path == "/containerInfo":
|
case u.Path == "/containerInfo":
|
||||||
container := u.Query().Get("container")
|
container := u.Query().Get("container")
|
||||||
if len(container) == 0 {
|
if len(container) == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user