Return application/json for image/load API (quite=1)
This fix tries to address the issue raised in 25529 wehre the image/load API returns `application/json` for quiet=0 and `text/plain` for quite=1. This fix makes the change so that `application/json` is returned for both quiet=0 and quite=1. This fix has been tested manually. This fix fixes 25529. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> Upstream-commit: 2f27632cde2f0e514bd3a8de77cc1934e5193a83 Component: engine
This commit is contained in:
@@ -201,17 +201,14 @@ func (s *imageRouter) postImagesLoad(ctx context.Context, w http.ResponseWriter,
|
||||
}
|
||||
quiet := httputils.BoolValueOrDefault(r, "quiet", true)
|
||||
|
||||
if !quiet {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
output := ioutils.NewWriteFlusher(w)
|
||||
defer output.Close()
|
||||
if err := s.backend.LoadImage(r.Body, output, quiet); err != nil {
|
||||
output.Write(streamformatter.NewJSONStreamFormatter().FormatError(err))
|
||||
}
|
||||
return nil
|
||||
output := ioutils.NewWriteFlusher(w)
|
||||
defer output.Close()
|
||||
if err := s.backend.LoadImage(r.Body, output, quiet); err != nil {
|
||||
output.Write(streamformatter.NewJSONStreamFormatter().FormatError(err))
|
||||
}
|
||||
return s.backend.LoadImage(r.Body, w, quiet)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *imageRouter) deleteImages(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
|
||||
@@ -30,8 +30,8 @@ func (l *tarexporter) Load(inTar io.ReadCloser, outStream io.Writer, quiet bool)
|
||||
)
|
||||
if !quiet {
|
||||
progressOutput = sf.NewProgressOutput(outStream, false)
|
||||
outStream = &streamformatter.StdoutFormatter{Writer: outStream, StreamFormatter: streamformatter.NewJSONStreamFormatter()}
|
||||
}
|
||||
outStream = &streamformatter.StdoutFormatter{Writer: outStream, StreamFormatter: streamformatter.NewJSONStreamFormatter()}
|
||||
|
||||
tmpDir, err := ioutil.TempDir("", "docker-import-")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user