diff options
Diffstat (limited to 'pkg/api/handlers/compat')
-rw-r--r-- | pkg/api/handlers/compat/exec.go | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/pkg/api/handlers/compat/exec.go b/pkg/api/handlers/compat/exec.go index f97fecca2..6f62dca11 100644 --- a/pkg/api/handlers/compat/exec.go +++ b/pkg/api/handlers/compat/exec.go @@ -159,33 +159,23 @@ func ExecResizeHandler(w http.ResponseWriter, r *http.Request) { // ExecStartHandler runs a given exec session. func ExecStartHandler(w http.ResponseWriter, r *http.Request) { runtime := r.Context().Value("runtime").(*libpod.Runtime) - decoder := r.Context().Value("decoder").(*schema.Decoder) sessionID := mux.Vars(r)["id"] - // TODO: Need to support these - query := struct { - Detach bool `schema:"Detach"` - Tty bool `schema:"Tty"` - }{ - // override any golang type defaults - } - if err := decoder.Decode(&query, r.URL.Query()); err != nil { - utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest, - errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String())) - return - } + // TODO: We should read/support Tty and Detach from here. + bodyParams := new(handlers.ExecStartConfig) - if _, found := r.URL.Query()["Detach"]; found { + if err := json.NewDecoder(r.Body).Decode(&bodyParams); err != nil { utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest, - errors.Errorf("Detached exec is not yet supported")) + errors.Wrapf(err, "failed to decode parameters for %s", r.URL.String())) return } - if _, found := r.URL.Query()["Tty"]; found { + if bodyParams.Detach == true { utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest, - errors.Errorf("overriding terminal setting in ExecStart is not yet supported")) + errors.Errorf("Detached exec is not yet supported")) return } + // TODO: Verify TTY setting against what inspect session was made with sessionCtr, err := runtime.GetExecSessionContainer(sessionID) if err != nil { |