Skip to content

Commit beca261

Browse files
author
Wang Xing
committed
Fix bug which mistakes 400 error for 500
Signed-off-by: Wang Xing <[email protected]>
1 parent 1691fe6 commit beca261

9 files changed

Lines changed: 10 additions & 0 deletions

api/server/httputils/errors.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func GetHTTPErrorStatusCode(err error) int {
4949
"not found": http.StatusNotFound,
5050
"no such": http.StatusNotFound,
5151
"bad parameter": http.StatusBadRequest,
52+
"no command": http.StatusBadRequest,
5253
"conflict": http.StatusConflict,
5354
"impossible": http.StatusNotAcceptable,
5455
"wrong login/password": http.StatusUnauthorized,

docs/reference/api/docker_remote_api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ This section lists each version from latest to oldest. Each listing includes a
116116
* `GET /info` now returns `SecurityOptions` field, showing if `apparmor`, `seccomp`, or `selinux` is supported.
117117
* `GET /networks` now supports filtering by `label` and `driver`.
118118
* `POST /containers/create` now takes `MaximumIOps` and `MaximumIOBps` fields. Windows daemon only.
119+
* `POST /containers/create` now returns a HTTP 400 "bad parameter" message
120+
if no command is specified (instead of a HTTP 500 "server error")
119121

120122
### v1.23 API changes
121123

docs/reference/api/docker_remote_api_v1.18.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ Query Parameters:
292292
Status Codes:
293293

294294
- **201** – no error
295+
- **400** – bad parameter
295296
- **404** – no such container
296297
- **406** – impossible to attach (container not running)
297298
- **500** – server error

docs/reference/api/docker_remote_api_v1.19.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ Query Parameters:
303303
Status Codes:
304304

305305
- **201** – no error
306+
- **400** – bad parameter
306307
- **404** – no such container
307308
- **406** – impossible to attach (container not running)
308309
- **500** – server error

docs/reference/api/docker_remote_api_v1.20.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ Query Parameters:
307307
Status Codes:
308308

309309
- **201** – no error
310+
- **400** – bad parameter
310311
- **404** – no such container
311312
- **406** – impossible to attach (container not running)
312313
- **500** – server error

docs/reference/api/docker_remote_api_v1.21.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ Query Parameters:
330330
Status Codes:
331331

332332
- **201** – no error
333+
- **400** – bad parameter
333334
- **404** – no such container
334335
- **406** – impossible to attach (container not running)
335336
- **500** – server error

docs/reference/api/docker_remote_api_v1.22.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ Query Parameters:
438438
Status Codes:
439439

440440
- **201** – no error
441+
- **400** – bad parameter
441442
- **404** – no such container
442443
- **406** – impossible to attach (container not running)
443444
- **500** – server error

docs/reference/api/docker_remote_api_v1.23.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ Query Parameters:
461461
Status Codes:
462462

463463
- **201** – no error
464+
- **400** – bad parameter
464465
- **404** – no such container
465466
- **406** – impossible to attach (container not running)
466467
- **500** – server error

docs/reference/api/docker_remote_api_v1.24.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ Query Parameters:
470470
Status Codes:
471471

472472
- **201** – no error
473+
- **400** – bad parameter
473474
- **404** – no such container
474475
- **406** – impossible to attach (container not running)
475476
- **500** – server error

0 commit comments

Comments
 (0)