mirror of
https://github.com/containers/podman.git
synced 2025-10-13 17:26:13 +08:00
fix: set header fields before response status code to prevent missing fields
Signed-off-by: Anders Hausding <anders.hausding@siemens.com>
This commit is contained in:
@ -120,8 +120,8 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
|
||||
statusWritten := false
|
||||
writeStatusCode := func(code int) {
|
||||
if !statusWritten {
|
||||
w.WriteHeader(code)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(code)
|
||||
flush()
|
||||
statusWritten = true
|
||||
}
|
||||
|
@ -76,8 +76,8 @@ func StatsContainer(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
// Write header and content type.
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
wroteContent = true
|
||||
}
|
||||
|
||||
|
@ -597,8 +597,8 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) {
|
||||
statusWritten := false
|
||||
writeStatusCode := func(code int) {
|
||||
if !statusWritten {
|
||||
w.WriteHeader(code)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(code)
|
||||
flush()
|
||||
statusWritten = true
|
||||
}
|
||||
|
@ -152,8 +152,8 @@ func ImagesPull(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
flush()
|
||||
|
||||
enc := json.NewEncoder(w)
|
||||
|
@ -138,8 +138,8 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
flush()
|
||||
|
||||
enc := json.NewEncoder(w)
|
||||
|
@ -451,8 +451,8 @@ func ManifestPush(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
flush()
|
||||
|
||||
enc := json.NewEncoder(w)
|
||||
|
@ -146,8 +146,8 @@ func CompatPull(ctx context.Context, w http.ResponseWriter, runtime *libpod.Runt
|
||||
statusWritten := false
|
||||
writeStatusCode := func(code int) {
|
||||
if !statusWritten {
|
||||
w.WriteHeader(code)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(code)
|
||||
flush()
|
||||
statusWritten = true
|
||||
}
|
||||
|
Reference in New Issue
Block a user