mirror of https://github.com/docker/docs.git
Changes response of postContainersWait to use a struct
Signed-off-by: Nick Parker <nikaios@gmail.com>
This commit is contained in:
parent
667452ec63
commit
1bc266dfa7
|
@ -877,7 +877,6 @@ func postContainersWait(eng *engine.Engine, version version.Version, w http.Resp
|
||||||
return fmt.Errorf("Missing parameter")
|
return fmt.Errorf("Missing parameter")
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
env engine.Env
|
|
||||||
stdoutBuffer = bytes.NewBuffer(nil)
|
stdoutBuffer = bytes.NewBuffer(nil)
|
||||||
job = eng.Job("wait", vars["name"])
|
job = eng.Job("wait", vars["name"])
|
||||||
)
|
)
|
||||||
|
@ -885,9 +884,13 @@ func postContainersWait(eng *engine.Engine, version version.Version, w http.Resp
|
||||||
if err := job.Run(); err != nil {
|
if err := job.Run(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
statusCode, err := strconv.Atoi(engine.Tail(stdoutBuffer, 1))
|
||||||
env.Set("StatusCode", engine.Tail(stdoutBuffer, 1))
|
if err != nil {
|
||||||
return writeJSONEnv(w, http.StatusOK, env)
|
return err
|
||||||
|
}
|
||||||
|
return writeJSON(w, http.StatusOK, &types.ContainerWaitResponse{
|
||||||
|
StatusCode: statusCode,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func postContainersResize(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
func postContainersResize(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||||
|
|
|
@ -24,3 +24,9 @@ type AuthResponse struct {
|
||||||
// Status is the authentication status
|
// Status is the authentication status
|
||||||
Status string `json:"Status"`
|
Status string `json:"Status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// POST /auth
|
||||||
|
type ContainerWaitResponse struct {
|
||||||
|
// StatusCode is the status code of the wait job
|
||||||
|
StatusCode int `json:"StatusCode"`
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue