Browse code

Revert "Change content-type for json stream to application/x-json-stream."

This reverts commit 10ab2089ce189d5bea3f7aaac3b5081471309478.

Conflicts:
api/client/utils.go
docs/sources/reference/api/docker_remote_api.md

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)

Jessica Frazelle authored on 2014/10/10 05:17:47
Showing 5 changed files
... ...
@@ -167,8 +167,8 @@ func (cli *DockerCli) streamHelper(method, path string, setRawTerminal bool, in
167 167
 		return fmt.Errorf("Error: %s", bytes.TrimSpace(body))
168 168
 	}
169 169
 
170
-	if api.MatchesContentType(resp.Header.Get("Content-Type"), "application/json") || api.MatchesContentType(resp.Header.Get("Content-Type"), "application/x-json-stream") {
171
-		return utils.DisplayJSONMessagesStream(resp.Body, stdout, cli.outFd, cli.isTerminalOut)
170
+	if api.MatchesContentType(resp.Header.Get("Content-Type"), "application/json") {
171
+		return utils.DisplayJSONMessagesStream(resp.Body, stdout, cli.terminalFd, cli.isTerminal)
172 172
 	}
173 173
 	if stdout != nil || stderr != nil {
174 174
 		// When TTY is ON, use regular copy
... ...
@@ -120,10 +120,6 @@ func writeJSON(w http.ResponseWriter, code int, v engine.Env) error {
120 120
 
121 121
 func streamJSON(job *engine.Job, w http.ResponseWriter, flush bool) {
122 122
 	w.Header().Set("Content-Type", "application/json")
123
-	if job.GetenvBool("lineDelim") {
124
-		w.Header().Set("Content-Type", "application/x-json-stream")
125
-	}
126
-
127 123
 	if flush {
128 124
 		job.Stdout.Add(utils.NewWriteFlusher(w))
129 125
 	} else {
... ...
@@ -993,9 +989,6 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
993 993
 		}
994 994
 	}
995 995
 
996
-	// This needs to be set before calls to streamJSON
997
-	job.SetenvBool("lineDelim", version.GreaterThanOrEqualTo("1.15"))
998
-
999 996
 	if version.GreaterThanOrEqualTo("1.8") {
1000 997
 		job.SetenvBool("json", true)
1001 998
 		streamJSON(job, w, true)
... ...
@@ -275,7 +275,7 @@ func TestGetEvents(t *testing.T) {
275 275
 	if !called {
276 276
 		t.Fatal("handler was not called")
277 277
 	}
278
-	assertContentType(r, "application/x-json-stream", t)
278
+	assertContentType(r, "application/json", t)
279 279
 	var stdout_json struct {
280 280
 		Since int
281 281
 		Until int
... ...
@@ -41,22 +41,6 @@ You can still call an old version of the API using
41 41
 
42 42
 ### What's new
43 43
 
44
-`POST /build`
45
-`GET /events`
46
-
47
-**New!**
48
-Now has header: `Content-Type: application/x-json-stream`.
49
-
50
-`POST /containers/(id)/exec`
51
-
52
-**New!**
53
-Setup an exec command in a running container `id`.
54
-
55
-`POST /exec/(id)/start`
56
-
57
-**New!**
58
-Start an exec command.
59
-
60 44
 ## v1.14
61 45
 
62 46
 ### Full Documentation
... ...
@@ -97,7 +81,7 @@ the `tag` parameter at the same time will return an error.
97 97
 The `HostConfig.Links` field is now filled correctly
98 98
 
99 99
 **New!**
100
-`Sockets` parameter added to the `/info` endpoint listing all the sockets the
100
+`Sockets` parameter added to the `/info` endpoint listing all the sockets the 
101 101
 daemon is configured to listen on.
102 102
 
103 103
 `POST /containers/(name)/start`
... ...
@@ -425,7 +409,7 @@ Builder (/build):
425 425
    intermediary buffers
426 426
  - Simpler, less memory usage, less disk usage and faster
427 427
 
428
-> **Warning**:
428
+> **Warning**: 
429 429
 > The /build improvements are not reverse-compatible. Pre 1.3 clients will
430 430
 > break on /build.
431 431
 
... ...
@@ -1082,7 +1082,7 @@ Build an image from Dockerfile via stdin
1082 1082
 **Example response**:
1083 1083
 
1084 1084
         HTTP/1.1 200 OK
1085
-        Content-Type: application/x-json-stream
1085
+        Content-Type: application/json
1086 1086
 
1087 1087
         {"stream":"Step 1..."}
1088 1088
         {"stream":"..."}
... ...
@@ -1317,7 +1317,7 @@ and Docker images will report:
1317 1317
 **Example response**:
1318 1318
 
1319 1319
         HTTP/1.1 200 OK
1320
-        Content-Type: application/x-json-stream
1320
+        Content-Type: application/json
1321 1321
 
1322 1322
         {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
1323 1323
         {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}