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

Changes response of postContainersWait to use a struct

Signed-off-by: Nick Parker <nikaios@gmail.com>
This commit is contained in:
Nick Parker 2015-03-25 21:01:14 -06:00
parent 667452ec63
commit 1bc266dfa7
2 changed files with 13 additions and 4 deletions

View file

@ -877,7 +877,6 @@ func postContainersWait(eng *engine.Engine, version version.Version, w http.Resp
return fmt.Errorf("Missing parameter")
}
var (
env engine.Env
stdoutBuffer = bytes.NewBuffer(nil)
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 {
return err
}
env.Set("StatusCode", engine.Tail(stdoutBuffer, 1))
return writeJSONEnv(w, http.StatusOK, env)
statusCode, err := strconv.Atoi(engine.Tail(stdoutBuffer, 1))
if err != nil {
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 {

View file

@ -24,3 +24,9 @@ type AuthResponse struct {
// Status is the authentication status
Status string `json:"Status"`
}
// POST /auth
type ContainerWaitResponse struct {
// StatusCode is the status code of the wait job
StatusCode int `json:"StatusCode"`
}