apache / openwhisk-client-go

Go client library for the Apache OpenWhisk platform
https://openwhisk.apache.org/
Apache License 2.0
36 stars 44 forks source link

invalid warning generated by http client #89

Closed rabbah closed 5 years ago

rabbah commented 6 years ago

https://github.com/apache/incubator-openwhisk-client-go/blob/df32dca4aecca4ec30add11ce89eac72928f95f4/whisk/client.go#L652-L659

will always emit a warning - @dubee is the intention to emit this warning only if err != nill?

diff --git a/whisk/client.go b/whisk/client.go
index 58a29b7..938d812 100644
--- a/whisk/client.go
+++ b/whisk/client.go
@@ -654,9 +654,12 @@ func IsResponseResultSuccess(data []byte) bool {
        err := json.Unmarshal(data, &errResp)
        if err == nil && errResp.Response != nil {
                return errResp.Response.Success
+       } else if err != nil {
+               Debug(DbgWarn, "IsResponseResultSuccess: failed to parse response result: %v\n", err)
+               return false
+       } else {
+               return true
        }
-       Debug(DbgWarn, "IsResponseResultSuccess: failed to parse response result: %v\n", err)
-       return true
 }

i can open a pr once you confirm.