Sebastiaan van Stijn
30e75b8396
client: improve handling of JSON error-responses with incorrect schema
...
Before this patch, an API response that's valid JSON, but not the right
schema would be silently discarded by the CLI. For example, due to a bug
in Docker Desktop's API proxy, the "normal" (not JSON error) response
would be returned together with a non-200 status code when using an
unsupported API version;
curl -s -w 'STATUS: %{http_code}\n' --unix-socket /var/run/docker.sock 'http://localhost/v1.99/version '
{"Platform":{"Name":"Docker Desktop 4.38.0 (181016)"},"Version":"","ApiVersion":"","GitCommit":"","GoVersion":"","Os":"","Arch":""}
STATUS: 400
Before this patch, this resulted in no output being shown;
DOCKER_API_VERSION=1.99 docker version
Client:
Version: 27.5.1
API version: 1.99 (downgraded from 1.47)
Go version: go1.22.11
Git commit: 9f9e405
Built: Wed Jan 22 13:37:19 2025
OS/Arch: darwin/arm64
Context: desktop-linux
Error response from daemon:
With this patch, an error is generated based on the status:
DOCKER_API_VERSION=1.99 docker version
Client:
Version: 27.5.1
API version: 1.99 (downgraded from 1.47)
Go version: go1.22.11
Git commit: 9f9e405
Built: Wed Jan 22 13:37:19 2025
OS/Arch: darwin/arm64
Context: desktop-linux
Error response from daemon: API returned a 400 (Bad Request) but provided no error-message
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2025-01-30 22:01:13 +01:00
..
2023-08-01 16:19:36 +02:00
2016-09-07 11:05:58 -07:00
2021-02-16 10:07:44 -05:00
2024-10-21 11:29:59 +02:00
2023-08-26 12:37:41 +02:00
2023-08-26 12:37:41 +02:00
2023-08-26 12:37:41 +02:00
2023-08-26 12:37:41 +02:00
2023-08-26 12:37:41 +02:00
2023-08-26 12:37:41 +02:00
2023-03-31 16:15:01 -04:00
2023-09-07 18:38:19 +00:00
2025-01-28 21:32:23 +01:00
2023-05-19 20:38:51 +02:00
2023-01-01 13:35:16 +01:00
2025-01-28 21:32:23 +01:00
2023-05-10 22:13:38 +02:00
2023-09-20 15:23:27 +02:00
2025-01-29 11:53:16 +01:00
2023-09-20 15:23:27 +02:00
2023-05-10 22:13:38 +02:00
2023-09-20 15:23:27 +02:00
2023-05-10 22:13:38 +02:00
2023-09-20 15:23:27 +02:00
2023-05-10 22:13:38 +02:00
2023-09-20 15:23:27 +02:00
2023-10-12 11:29:23 +02:00
2023-10-12 11:29:23 +02:00
2023-10-12 11:29:23 +02:00
2024-06-10 10:20:47 +02:00
2024-06-10 10:20:47 +02:00
2024-12-09 21:05:29 +08:00
2024-09-26 17:11:13 +02:00
2023-05-03 21:25:07 +02:00
2023-05-03 21:23:42 +02:00
2024-06-10 10:19:46 +02:00
2024-06-10 10:19:46 +02:00
2023-05-10 22:13:38 +02:00
2018-04-23 13:52:44 -07:00
2025-01-29 11:53:16 +01:00
2024-07-02 12:50:24 +02:00
2023-05-10 22:13:38 +02:00
2022-04-19 17:40:33 +02:00
2024-07-02 12:46:48 +02:00
2024-07-02 12:46:48 +02:00
2023-10-12 11:30:12 +02:00
2023-10-12 11:30:12 +02:00
2023-05-10 22:13:38 +02:00
2018-04-23 13:52:44 -07:00
2024-06-10 10:19:47 +02:00
2024-10-21 11:29:59 +02:00
2023-10-12 11:29:23 +02:00
2023-10-12 11:29:23 +02:00
2023-05-10 22:13:38 +02:00
2018-04-23 13:52:44 -07:00
2024-10-17 14:04:37 +02:00
2024-10-17 14:04:37 +02:00
2024-02-23 15:17:10 +01:00
2024-02-23 15:17:10 +01:00
2023-10-12 11:29:24 +02:00
2023-10-12 11:29:24 +02:00
2023-05-10 22:13:38 +02:00
2024-06-20 08:54:52 +02:00
2024-02-23 15:17:10 +01:00
2024-02-23 15:17:10 +01:00
2023-05-10 22:13:38 +02:00
2019-03-18 15:26:21 +01:00
2023-05-10 22:13:38 +02:00
2018-04-23 13:52:44 -07:00
2023-05-10 22:13:38 +02:00
2021-02-16 10:07:44 -05:00
2025-01-29 11:53:16 +01:00
2024-02-23 15:17:10 +01:00
2023-05-10 22:13:38 +02:00
2021-07-27 12:17:45 +02:00
2025-01-29 11:53:16 +01:00
2024-01-19 12:49:53 +01:00
2022-03-07 12:35:55 +01:00
2024-02-23 15:17:10 +01:00
2024-06-10 10:21:24 +02:00
2024-06-10 10:21:24 +02:00
2025-01-29 11:53:16 +01:00
2023-12-18 13:16:37 -08:00
2024-10-12 16:06:36 +02:00
2024-10-12 16:06:43 +02:00
2024-01-24 00:10:33 +01:00
2024-01-24 00:10:33 +01:00
2024-11-05 13:28:28 +01:00
2024-11-05 13:28:15 +01:00
2024-11-19 13:30:59 +01:00
2024-11-19 13:30:59 +01:00
2025-01-29 11:53:16 +01:00
2024-07-02 12:46:48 +02:00
2024-11-12 14:02:12 +01:00
2024-08-07 13:48:54 +02:00
2024-11-19 15:56:28 +01:00
2024-11-19 15:56:28 +01:00
2024-06-10 10:21:24 +02:00
2024-10-21 11:29:59 +02:00
2024-03-22 13:06:43 +01:00
2024-03-22 13:06:43 +01:00
2024-11-12 14:02:12 +01:00
2024-06-10 13:35:13 +02:00
2024-01-24 00:10:33 +01:00
2024-01-24 00:10:33 +01:00
2024-11-19 15:56:28 +01:00
2024-11-19 15:56:28 +01:00
2024-06-10 10:21:24 +02:00
2024-06-10 10:21:24 +02:00
2024-11-12 14:02:12 +01:00
2023-09-05 12:09:26 +02:00
2023-07-07 13:01:36 +02:00
2023-07-07 13:01:36 +02:00
2023-08-26 12:37:41 +02:00
2018-02-05 16:51:57 -05:00
2024-09-11 19:44:35 +02:00
2022-07-29 23:05:15 +02:00
2024-05-29 19:22:37 +02:00
2024-05-29 19:22:37 +02:00
2024-06-07 11:11:15 +02:00
2024-06-07 12:06:39 +02:00
2024-05-29 19:22:37 +02:00
2024-05-29 19:22:37 +02:00
2024-06-04 17:44:46 +02:00
2024-06-04 17:44:46 +02:00
2024-06-04 17:44:46 +02:00
2024-06-04 17:44:46 +02:00
2024-06-07 11:14:52 +02:00
2024-10-21 11:29:59 +02:00
2023-05-10 22:13:38 +02:00
2022-03-20 19:04:52 +01:00
2025-01-29 11:53:16 +01:00
2022-03-20 19:04:52 +01:00
2023-05-10 22:13:38 +02:00
2023-06-29 00:25:21 +02:00
2023-05-10 22:13:38 +02:00
2022-03-20 19:04:52 +01:00
2023-05-10 22:13:38 +02:00
2022-05-13 02:40:14 +02:00
2023-06-09 09:59:29 +02:00
2025-01-28 21:32:23 +01:00
2024-12-08 22:23:57 +00:00
2024-12-08 22:23:57 +00:00
2019-03-18 15:26:21 +01:00
2023-05-10 22:13:38 +02:00
2018-04-23 13:52:44 -07:00
2023-05-10 22:13:38 +02:00
2018-04-23 13:52:44 -07:00
2025-01-29 11:53:16 +01:00
2022-03-20 19:04:52 +01:00
2024-03-22 13:06:43 +01:00
2023-05-10 22:13:38 +02:00
2022-03-20 19:04:52 +01:00
2023-05-10 22:13:38 +02:00
2023-07-11 13:14:28 +02:00
2023-05-10 22:13:38 +02:00
2022-03-20 19:04:52 +01:00
2023-05-10 22:13:38 +02:00
2018-04-23 13:52:44 -07:00
2023-09-20 15:23:27 +02:00
2023-11-14 12:27:35 +01:00
2025-01-30 22:01:13 +01:00
2025-01-30 22:01:13 +01:00
2023-05-10 22:13:38 +02:00
2023-09-20 15:23:27 +02:00
2025-01-29 11:53:16 +01:00
2023-09-20 15:23:27 +02:00
2023-05-10 22:13:38 +02:00
2023-09-20 15:23:27 +02:00
2023-05-10 22:13:38 +02:00
2023-09-20 15:23:27 +02:00
2023-05-10 22:13:38 +02:00
2023-09-20 15:23:27 +02:00
2024-02-23 15:17:10 +01:00
2024-02-23 15:17:10 +01:00
2025-01-29 11:53:16 +01:00
2022-03-20 19:04:52 +01:00
2023-05-10 22:13:38 +02:00
2019-10-14 10:43:00 -05:00
2023-10-12 11:30:12 +02:00
2023-10-12 11:30:12 +02:00
2023-05-10 22:13:38 +02:00
2022-03-20 19:04:52 +01:00
2024-02-23 15:17:10 +01:00
2024-02-23 15:17:10 +01:00
2023-05-10 22:13:38 +02:00
2019-03-18 15:26:21 +01:00
2023-05-10 22:13:38 +02:00
2019-03-18 15:26:21 +01:00
2023-05-10 22:13:38 +02:00
2019-03-18 15:26:21 +01:00
2023-05-10 22:13:38 +02:00
2018-04-23 13:52:44 -07:00
2023-05-10 22:13:38 +02:00
2018-04-23 13:52:44 -07:00
2023-05-10 22:13:38 +02:00
2018-04-23 13:52:44 -07:00
2023-05-10 22:13:38 +02:00
2022-05-13 02:40:14 +02:00
2025-01-29 11:53:16 +01:00
2022-03-20 19:04:52 +01:00
2023-05-10 22:13:38 +02:00
2019-03-18 15:26:21 +01:00
2023-10-12 11:30:12 +02:00
2024-10-31 20:40:27 +01:00
2025-01-02 21:37:32 +01:00
2019-03-18 15:26:21 +01:00
2023-05-10 22:13:38 +02:00
2022-04-28 22:39:14 +02:00
2025-01-29 11:53:16 +01:00
2022-04-21 19:50:59 +02:00
2023-05-10 22:13:38 +02:00
2022-08-03 23:30:28 +02:00
2024-10-21 11:29:59 +02:00
2024-02-23 15:17:10 +01:00
2024-02-23 15:17:10 +01:00
2023-05-10 22:13:38 +02:00
2023-09-20 15:23:27 +02:00