1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #8054 from estesp/6830-fix-json-strings

Proper JSON handling of strings that could be represented as other types
This commit is contained in:
Tibor Vass 2014-09-16 15:11:25 -04:00
commit f88e2e8b99
3 changed files with 6 additions and 2 deletions

View file

@ -61,7 +61,7 @@ func dockerVersion(job *engine.Job) engine.Status {
v := &engine.Env{}
v.SetJson("Version", dockerversion.VERSION)
v.SetJson("ApiVersion", api.APIVERSION)
v.Set("GitCommit", dockerversion.GITCOMMIT)
v.SetJson("GitCommit", dockerversion.GITCOMMIT)
v.Set("GoVersion", runtime.Version())
v.Set("Os", runtime.GOOS)
v.Set("Arch", runtime.GOARCH)

View file

@ -31,7 +31,7 @@ func (daemon *Daemon) ContainerInspect(job *engine.Job) engine.Status {
out := &engine.Env{}
out.Set("Id", container.ID)
out.SetAuto("Created", container.Created)
out.Set("Path", container.Path)
out.SetJson("Path", container.Path)
out.SetList("Args", container.Args)
out.SetJson("Config", container.Config)
out.SetJson("State", container.State)

View file

@ -46,6 +46,10 @@ func TestInspectContainerResponse(t *testing.T) {
t.Fatalf("%s does not exist in reponse for %s version", key, testVersion)
}
}
//Issue #6830: type not properly converted to JSON/back
if _, ok := inspect_json["Path"].(bool); ok {
t.Fatalf("Path of `true` should not be converted to boolean `true` via JSON marshalling")
}
}
deleteAllContainers()