From 98500d10f5adee0abad2c2bc79c0d47c70124cce Mon Sep 17 00:00:00 2001 From: Dan Ramich Date: Fri, 27 Apr 2018 13:33:05 -0700 Subject: [PATCH] Update doAction to not expect a response Problem: doAction assumes that an action would have a response body which causes JSON unmarshal errors Solution: Only attempt to Unmarshal when a response is expected --- clientbase/ops.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/clientbase/ops.go b/clientbase/ops.go index b96d1760..740ea5c4 100644 --- a/clientbase/ops.go +++ b/clientbase/ops.go @@ -285,6 +285,10 @@ func (a *APIOperations) doAction( var input io.Reader + if debug { + fmt.Println("POST " + actionURL) + } + if inputObject != nil { bodyContent, err := json.Marshal(inputObject) if err != nil { @@ -325,5 +329,8 @@ func (a *APIOperations) doAction( fmt.Println("Response <= " + string(byteContent)) } - return json.Unmarshal(byteContent, respObject) + if nil != respObject { + return json.Unmarshal(byteContent, respObject) + } + return nil }