mirror of
https://github.com/containers/podman.git
synced 2025-06-27 13:38:49 +08:00
HTTP 304 (NotModified) is not an error!
Even after #5169, my test logs kept showing: ERRO[0004] unable to write json: "http: request method or response status code does not allow body" Cause: overly-helpful code trying to treat condition as an error and include a diagnostic message. This is forbidden per rfc2616. This PR fixes the faulty response, as well as three others found via: $ ack 'Error.*NotMod' (4 hits total) $ ack 'Error.*NoCont' (no hits) Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -202,8 +202,7 @@ func PodStop(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
if allContainersStopped {
|
||||
alreadyStopped := errors.Errorf("pod %s is already stopped", pod.ID())
|
||||
utils.Error(w, "Something went wrong", http.StatusNotModified, alreadyStopped)
|
||||
utils.WriteResponse(w, http.StatusNotModified, "")
|
||||
return
|
||||
}
|
||||
|
||||
@ -249,8 +248,7 @@ func PodStart(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
if allContainersRunning {
|
||||
alreadyRunning := errors.Errorf("pod %s is already running", pod.ID())
|
||||
utils.Error(w, "Something went wrong", http.StatusNotModified, alreadyRunning)
|
||||
utils.WriteResponse(w, http.StatusNotModified, "")
|
||||
return
|
||||
}
|
||||
if _, err := pod.Start(r.Context()); err != nil {
|
||||
|
Reference in New Issue
Block a user