mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #43552 from thaJeztah/remove_redundant_validation
api: postContainersStop, postContainersRestart remove redundant validation
This commit is contained in:
commit
7b08faa089
1 changed files with 2 additions and 12 deletions
|
@ -225,12 +225,7 @@ func (s *containerRouter) postContainersStop(ctx context.Context, w http.Respons
|
||||||
version = httputils.VersionFromContext(ctx)
|
version = httputils.VersionFromContext(ctx)
|
||||||
)
|
)
|
||||||
if versions.GreaterThanOrEqualTo(version, "1.42") {
|
if versions.GreaterThanOrEqualTo(version, "1.42") {
|
||||||
if sig := r.Form.Get("signal"); sig != "" {
|
options.Signal = r.Form.Get("signal")
|
||||||
if _, err := signal.ParseSignal(sig); err != nil {
|
|
||||||
return errdefs.InvalidParameter(err)
|
|
||||||
}
|
|
||||||
options.Signal = sig
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if tmpSeconds := r.Form.Get("t"); tmpSeconds != "" {
|
if tmpSeconds := r.Form.Get("t"); tmpSeconds != "" {
|
||||||
valSeconds, err := strconv.Atoi(tmpSeconds)
|
valSeconds, err := strconv.Atoi(tmpSeconds)
|
||||||
|
@ -283,12 +278,7 @@ func (s *containerRouter) postContainersRestart(ctx context.Context, w http.Resp
|
||||||
version = httputils.VersionFromContext(ctx)
|
version = httputils.VersionFromContext(ctx)
|
||||||
)
|
)
|
||||||
if versions.GreaterThanOrEqualTo(version, "1.42") {
|
if versions.GreaterThanOrEqualTo(version, "1.42") {
|
||||||
if sig := r.Form.Get("signal"); sig != "" {
|
options.Signal = r.Form.Get("signal")
|
||||||
if _, err := signal.ParseSignal(sig); err != nil {
|
|
||||||
return errdefs.InvalidParameter(err)
|
|
||||||
}
|
|
||||||
options.Signal = sig
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if tmpSeconds := r.Form.Get("t"); tmpSeconds != "" {
|
if tmpSeconds := r.Form.Get("t"); tmpSeconds != "" {
|
||||||
valSeconds, err := strconv.Atoi(tmpSeconds)
|
valSeconds, err := strconv.Atoi(tmpSeconds)
|
||||||
|
|
Loading…
Reference in a new issue