Browse code

Fix bug which mistakes 400 error for 500

Signed-off-by: Wang Xing <hzwangxing@corp.netease.com>

Wang Xing authored on 2016/05/16 18:15:45
Showing 9 changed files
... ...
@@ -49,6 +49,7 @@ func GetHTTPErrorStatusCode(err error) int {
49 49
 			"not found":             http.StatusNotFound,
50 50
 			"no such":               http.StatusNotFound,
51 51
 			"bad parameter":         http.StatusBadRequest,
52
+			"no command":            http.StatusBadRequest,
52 53
 			"conflict":              http.StatusConflict,
53 54
 			"impossible":            http.StatusNotAcceptable,
54 55
 			"wrong login/password":  http.StatusUnauthorized,
... ...
@@ -116,6 +116,8 @@ This section lists each version from latest to oldest.  Each listing includes a
116 116
 * `GET /info` now returns `SecurityOptions` field, showing if `apparmor`, `seccomp`, or `selinux` is supported.
117 117
 * `GET /networks` now supports filtering by `label` and `driver`.
118 118
 * `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")
119 121
 
120 122
 ### v1.23 API changes
121 123
 
... ...
@@ -292,6 +292,7 @@ Query Parameters:
292 292
 Status Codes:
293 293
 
294 294
 -   **201** – no error
295
+-   **400** – bad parameter
295 296
 -   **404** – no such container
296 297
 -   **406** – impossible to attach (container not running)
297 298
 -   **500** – server error
... ...
@@ -303,6 +303,7 @@ Query Parameters:
303 303
 Status Codes:
304 304
 
305 305
 -   **201** – no error
306
+-   **400** – bad parameter
306 307
 -   **404** – no such container
307 308
 -   **406** – impossible to attach (container not running)
308 309
 -   **500** – server error
... ...
@@ -307,6 +307,7 @@ Query Parameters:
307 307
 Status Codes:
308 308
 
309 309
 -   **201** – no error
310
+-   **400** – bad parameter
310 311
 -   **404** – no such container
311 312
 -   **406** – impossible to attach (container not running)
312 313
 -   **500** – server error
... ...
@@ -330,6 +330,7 @@ Query Parameters:
330 330
 Status Codes:
331 331
 
332 332
 -   **201** – no error
333
+-   **400** – bad parameter
333 334
 -   **404** – no such container
334 335
 -   **406** – impossible to attach (container not running)
335 336
 -   **500** – server error
... ...
@@ -438,6 +438,7 @@ Query Parameters:
438 438
 Status Codes:
439 439
 
440 440
 -   **201** – no error
441
+-   **400** – bad parameter
441 442
 -   **404** – no such container
442 443
 -   **406** – impossible to attach (container not running)
443 444
 -   **500** – server error
... ...
@@ -461,6 +461,7 @@ Query Parameters:
461 461
 Status Codes:
462 462
 
463 463
 -   **201** – no error
464
+-   **400** – bad parameter
464 465
 -   **404** – no such container
465 466
 -   **406** – impossible to attach (container not running)
466 467
 -   **500** – server error
... ...
@@ -470,6 +470,7 @@ Query Parameters:
470 470
 Status Codes:
471 471
 
472 472
 -   **201** – no error
473
+-   **400** – bad parameter
473 474
 -   **404** – no such container
474 475
 -   **406** – impossible to attach (container not running)
475 476
 -   **500** – server error