diff --git a/api/server/router/volume/volume_routes.go b/api/server/router/volume/volume_routes.go index bfff51ab1e..fef68960b4 100644 --- a/api/server/router/volume/volume_routes.go +++ b/api/server/router/volume/volume_routes.go @@ -2,11 +2,14 @@ package volume import ( "encoding/json" + "errors" + "io" "net/http" "github.com/docker/docker/api/server/httputils" "github.com/docker/docker/api/types/filters" volumetypes "github.com/docker/docker/api/types/volume" + "github.com/docker/docker/errdefs" "golang.org/x/net/context" ) @@ -45,6 +48,9 @@ func (v *volumeRouter) postVolumesCreate(ctx context.Context, w http.ResponseWri var req volumetypes.VolumesCreateBody if err := json.NewDecoder(r.Body).Decode(&req); err != nil { + if err == io.EOF { + return errdefs.InvalidParameter(errors.New("got EOF while reading request body")) + } return err }