From 3bd80ac9ae2ea512a5ce9140bedab742910d0513 Mon Sep 17 00:00:00 2001 From: Ondra Machacek Date: Wed, 20 Oct 2021 18:45:56 +0200 Subject: Handle HTTP 409 error messages properly for Pod actions This PR fixes the case when the API return HTTP 409 response. Where the API return the body format different then for other HTTP error codes. Signed-off-by: Ondra Machacek --- pkg/bindings/connection.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'pkg/bindings/connection.go') diff --git a/pkg/bindings/connection.go b/pkg/bindings/connection.go index e2c46e481..2fe86ca39 100644 --- a/pkg/bindings/connection.go +++ b/pkg/bindings/connection.go @@ -379,6 +379,11 @@ func (h *APIResponse) IsClientError() bool { return h.Response.StatusCode/100 == 4 } +// IsConflictError returns true if the response code is 409 +func (h *APIResponse) IsConflictError() bool { + return h.Response.StatusCode == 409 +} + // IsServerError returns true if the response code is 5xx func (h *APIResponse) IsServerError() bool { return h.Response.StatusCode/100 == 5 -- cgit v1.2.3-54-g00ecf