From 30d6ff99fc6a22937b21bd9f35610d5f74a9b6e7 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Mon, 6 Oct 2014 18:47:04 +0300 Subject: [PATCH] Fix streaming JSON Content-type for postBuild MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See #8101 lineDelim is used by streamJSON() so it needs to be set before its called. Signed-off-by: Tõnis Tiigi (github: tonistiigi) --- api/server/server.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/server/server.go b/api/server/server.go index 27fe305106..0a64c8fbf7 100644 --- a/api/server/server.go +++ b/api/server/server.go @@ -993,6 +993,9 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite } } + // This needs to be set before calls to streamJSON + job.SetenvBool("lineDelim", version.GreaterThanOrEqualTo("1.15")) + if version.GreaterThanOrEqualTo("1.8") { job.SetenvBool("json", true) streamJSON(job, w, true) @@ -1013,7 +1016,6 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite job.Setenv("q", r.FormValue("q")) job.Setenv("nocache", r.FormValue("nocache")) job.Setenv("forcerm", r.FormValue("forcerm")) - job.SetenvBool("lineDelim", version.GreaterThanOrEqualTo("1.15")) job.SetenvJson("authConfig", authConfig) job.SetenvJson("configFile", configFile)