Browse code

Return error for bad content-type Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)

Michael Crosby authored on 2014/08/02 07:26:30
Showing 1 changed files
... ...
@@ -725,10 +725,12 @@ func postContainersStart(eng *engine.Engine, version version.Version, w http.Res
725 725
 
726 726
 	// allow a nil body for backwards compatibility
727 727
 	if r.Body != nil {
728
-		if api.MatchesContentType(r.Header.Get("Content-Type"), "application/json") {
729
-			if err := job.DecodeEnv(r.Body); err != nil {
730
-				return err
731
-			}
728
+		if !api.MatchesContentType(r.Header.Get("Content-Type"), "application/json") {
729
+			return fmt.Errorf("Content-Type is not supported: %s", r.Header.Get("Content-Type"))
730
+		}
731
+
732
+		if err := job.DecodeEnv(r.Body); err != nil {
733
+			return err
732 734
 		}
733 735
 	}
734 736
 	if err := job.Run(); err != nil {