mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #11789 from parknicker/PostContainerWaitFix
Changes response of postContainersWait to use a struct
This commit is contained in:
commit
d4fca8047c
2 changed files with 13 additions and 4 deletions
|
@ -878,7 +878,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"])
|
||||
)
|
||||
|
@ -886,9 +885,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 {
|
||||
|
|
|
@ -24,3 +24,9 @@ type AuthResponse struct {
|
|||
// Status is the authentication status
|
||||
Status string `json:"Status"`
|
||||
}
|
||||
|
||||
// POST "/containers/"+containerID+"/wait"
|
||||
type ContainerWaitResponse struct {
|
||||
// StatusCode is the status code of the wait job
|
||||
StatusCode int `json:"StatusCode"`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue