From beca2615782e24fa28803ada067129fdfa88c77d Mon Sep 17 00:00:00 2001 From: Wang Xing Date: Mon, 16 May 2016 17:15:45 +0800 Subject: [PATCH] Fix bug which mistakes 400 error for 500 Signed-off-by: Wang Xing --- api/server/httputils/errors.go | 1 + docs/reference/api/docker_remote_api.md | 2 ++ docs/reference/api/docker_remote_api_v1.18.md | 1 + docs/reference/api/docker_remote_api_v1.19.md | 1 + docs/reference/api/docker_remote_api_v1.20.md | 1 + docs/reference/api/docker_remote_api_v1.21.md | 1 + docs/reference/api/docker_remote_api_v1.22.md | 1 + docs/reference/api/docker_remote_api_v1.23.md | 1 + docs/reference/api/docker_remote_api_v1.24.md | 1 + 9 files changed, 10 insertions(+) diff --git a/api/server/httputils/errors.go b/api/server/httputils/errors.go index 5f0f5caa52..e3eaba9290 100644 --- a/api/server/httputils/errors.go +++ b/api/server/httputils/errors.go @@ -49,6 +49,7 @@ func GetHTTPErrorStatusCode(err error) int { "not found": http.StatusNotFound, "no such": http.StatusNotFound, "bad parameter": http.StatusBadRequest, + "no command": http.StatusBadRequest, "conflict": http.StatusConflict, "impossible": http.StatusNotAcceptable, "wrong login/password": http.StatusUnauthorized, diff --git a/docs/reference/api/docker_remote_api.md b/docs/reference/api/docker_remote_api.md index 234c3d2a29..3e6f197451 100644 --- a/docs/reference/api/docker_remote_api.md +++ b/docs/reference/api/docker_remote_api.md @@ -116,6 +116,8 @@ This section lists each version from latest to oldest. Each listing includes a * `GET /info` now returns `SecurityOptions` field, showing if `apparmor`, `seccomp`, or `selinux` is supported. * `GET /networks` now supports filtering by `label` and `driver`. * `POST /containers/create` now takes `MaximumIOps` and `MaximumIOBps` fields. Windows daemon only. +* `POST /containers/create` now returns a HTTP 400 "bad parameter" message + if no command is specified (instead of a HTTP 500 "server error") ### v1.23 API changes diff --git a/docs/reference/api/docker_remote_api_v1.18.md b/docs/reference/api/docker_remote_api_v1.18.md index b4b8970c59..02c8caa70c 100644 --- a/docs/reference/api/docker_remote_api_v1.18.md +++ b/docs/reference/api/docker_remote_api_v1.18.md @@ -292,6 +292,7 @@ Query Parameters: Status Codes: - **201** – no error +- **400** – bad parameter - **404** – no such container - **406** – impossible to attach (container not running) - **500** – server error diff --git a/docs/reference/api/docker_remote_api_v1.19.md b/docs/reference/api/docker_remote_api_v1.19.md index 3d44813a31..c38a349934 100644 --- a/docs/reference/api/docker_remote_api_v1.19.md +++ b/docs/reference/api/docker_remote_api_v1.19.md @@ -303,6 +303,7 @@ Query Parameters: Status Codes: - **201** – no error +- **400** – bad parameter - **404** – no such container - **406** – impossible to attach (container not running) - **500** – server error diff --git a/docs/reference/api/docker_remote_api_v1.20.md b/docs/reference/api/docker_remote_api_v1.20.md index b669ce22c4..1435149f9a 100644 --- a/docs/reference/api/docker_remote_api_v1.20.md +++ b/docs/reference/api/docker_remote_api_v1.20.md @@ -307,6 +307,7 @@ Query Parameters: Status Codes: - **201** – no error +- **400** – bad parameter - **404** – no such container - **406** – impossible to attach (container not running) - **500** – server error diff --git a/docs/reference/api/docker_remote_api_v1.21.md b/docs/reference/api/docker_remote_api_v1.21.md index 01a5998b98..cbe63758aa 100644 --- a/docs/reference/api/docker_remote_api_v1.21.md +++ b/docs/reference/api/docker_remote_api_v1.21.md @@ -330,6 +330,7 @@ Query Parameters: Status Codes: - **201** – no error +- **400** – bad parameter - **404** – no such container - **406** – impossible to attach (container not running) - **500** – server error diff --git a/docs/reference/api/docker_remote_api_v1.22.md b/docs/reference/api/docker_remote_api_v1.22.md index 3c6ec0e989..615298cc7f 100644 --- a/docs/reference/api/docker_remote_api_v1.22.md +++ b/docs/reference/api/docker_remote_api_v1.22.md @@ -438,6 +438,7 @@ Query Parameters: Status Codes: - **201** – no error +- **400** – bad parameter - **404** – no such container - **406** – impossible to attach (container not running) - **500** – server error diff --git a/docs/reference/api/docker_remote_api_v1.23.md b/docs/reference/api/docker_remote_api_v1.23.md index cff4bcedc6..f30d831fb4 100644 --- a/docs/reference/api/docker_remote_api_v1.23.md +++ b/docs/reference/api/docker_remote_api_v1.23.md @@ -461,6 +461,7 @@ Query Parameters: Status Codes: - **201** – no error +- **400** – bad parameter - **404** – no such container - **406** – impossible to attach (container not running) - **500** – server error diff --git a/docs/reference/api/docker_remote_api_v1.24.md b/docs/reference/api/docker_remote_api_v1.24.md index 399d8e6a8c..aa47ef7f2a 100644 --- a/docs/reference/api/docker_remote_api_v1.24.md +++ b/docs/reference/api/docker_remote_api_v1.24.md @@ -470,6 +470,7 @@ Query Parameters: Status Codes: - **201** – no error +- **400** – bad parameter - **404** – no such container - **406** – impossible to attach (container not running) - **500** – server error