mirror of
https://github.com/rancher/norman.git
synced 2025-08-11 20:21:41 +00:00
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
This commit is contained in:
parent
e6973cb055
commit
98500d10f5
@ -285,6 +285,10 @@ func (a *APIOperations) doAction(
|
|||||||
|
|
||||||
var input io.Reader
|
var input io.Reader
|
||||||
|
|
||||||
|
if debug {
|
||||||
|
fmt.Println("POST " + actionURL)
|
||||||
|
}
|
||||||
|
|
||||||
if inputObject != nil {
|
if inputObject != nil {
|
||||||
bodyContent, err := json.Marshal(inputObject)
|
bodyContent, err := json.Marshal(inputObject)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -325,5 +329,8 @@ func (a *APIOperations) doAction(
|
|||||||
fmt.Println("Response <= " + string(byteContent))
|
fmt.Println("Response <= " + string(byteContent))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if nil != respObject {
|
||||||
return json.Unmarshal(byteContent, respObject)
|
return json.Unmarshal(byteContent, respObject)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user