mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Return error for bad content-type
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
This commit is contained in:
parent
69aa07af1e
commit
78ac75fe00
1 changed files with 6 additions and 4 deletions
|
@ -725,10 +725,12 @@ func postContainersStart(eng *engine.Engine, version version.Version, w http.Res
|
|||
|
||||
// allow a nil body for backwards compatibility
|
||||
if r.Body != nil {
|
||||
if api.MatchesContentType(r.Header.Get("Content-Type"), "application/json") {
|
||||
if err := job.DecodeEnv(r.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
if !api.MatchesContentType(r.Header.Get("Content-Type"), "application/json") {
|
||||
return fmt.Errorf("Content-Type is not supported: %s", r.Header.Get("Content-Type"))
|
||||
}
|
||||
|
||||
if err := job.DecodeEnv(r.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := job.Run(); err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue