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

This reverts commit 10ab2089ce.

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)
This commit is contained in:
Jessica Frazelle 2014-10-09 13:17:47 -07:00
parent 4eb812e042
commit 4c6b7cd1b5
5 changed files with 7 additions and 30 deletions

View File

@ -167,8 +167,8 @@ func (cli *DockerCli) streamHelper(method, path string, setRawTerminal bool, in
return fmt.Errorf("Error: %s", bytes.TrimSpace(body)) return fmt.Errorf("Error: %s", bytes.TrimSpace(body))
} }
if api.MatchesContentType(resp.Header.Get("Content-Type"), "application/json") || api.MatchesContentType(resp.Header.Get("Content-Type"), "application/x-json-stream") { if api.MatchesContentType(resp.Header.Get("Content-Type"), "application/json") {
return utils.DisplayJSONMessagesStream(resp.Body, stdout, cli.outFd, cli.isTerminalOut) return utils.DisplayJSONMessagesStream(resp.Body, stdout, cli.terminalFd, cli.isTerminal)
} }
if stdout != nil || stderr != nil { if stdout != nil || stderr != nil {
// When TTY is ON, use regular copy // When TTY is ON, use regular copy

View File

@ -120,10 +120,6 @@ func writeJSON(w http.ResponseWriter, code int, v engine.Env) error {
func streamJSON(job *engine.Job, w http.ResponseWriter, flush bool) { func streamJSON(job *engine.Job, w http.ResponseWriter, flush bool) {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
if job.GetenvBool("lineDelim") {
w.Header().Set("Content-Type", "application/x-json-stream")
}
if flush { if flush {
job.Stdout.Add(utils.NewWriteFlusher(w)) job.Stdout.Add(utils.NewWriteFlusher(w))
} else { } else {
@ -993,9 +989,6 @@ 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") { if version.GreaterThanOrEqualTo("1.8") {
job.SetenvBool("json", true) job.SetenvBool("json", true)
streamJSON(job, w, true) streamJSON(job, w, true)

View File

@ -275,7 +275,7 @@ func TestGetEvents(t *testing.T) {
if !called { if !called {
t.Fatal("handler was not called") t.Fatal("handler was not called")
} }
assertContentType(r, "application/x-json-stream", t) assertContentType(r, "application/json", t)
var stdout_json struct { var stdout_json struct {
Since int Since int
Until int Until int

View File

@ -41,22 +41,6 @@ You can still call an old version of the API using
### What's new ### What's new
`POST /build`
`GET /events`
**New!**
Now has header: `Content-Type: application/x-json-stream`.
`POST /containers/(id)/exec`
**New!**
Setup an exec command in a running container `id`.
`POST /exec/(id)/start`
**New!**
Start an exec command.
## v1.14 ## v1.14
### Full Documentation ### Full Documentation
@ -97,7 +81,7 @@ the `tag` parameter at the same time will return an error.
The `HostConfig.Links` field is now filled correctly The `HostConfig.Links` field is now filled correctly
**New!** **New!**
`Sockets` parameter added to the `/info` endpoint listing all the sockets the `Sockets` parameter added to the `/info` endpoint listing all the sockets the
daemon is configured to listen on. daemon is configured to listen on.
`POST /containers/(name)/start` `POST /containers/(name)/start`
@ -425,7 +409,7 @@ Builder (/build):
intermediary buffers intermediary buffers
- Simpler, less memory usage, less disk usage and faster - Simpler, less memory usage, less disk usage and faster
> **Warning**: > **Warning**:
> The /build improvements are not reverse-compatible. Pre 1.3 clients will > The /build improvements are not reverse-compatible. Pre 1.3 clients will
> break on /build. > break on /build.

View File

@ -1082,7 +1082,7 @@ Build an image from Dockerfile via stdin
**Example response**: **Example response**:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/x-json-stream Content-Type: application/json
{"stream":"Step 1..."} {"stream":"Step 1..."}
{"stream":"..."} {"stream":"..."}
@ -1317,7 +1317,7 @@ and Docker images will report:
**Example response**: **Example response**:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/x-json-stream Content-Type: application/json
{"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924} {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
{"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924} {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}