This is an automated email from the ASF dual-hosted git repository.

dubeejw pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-openwhisk-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new d3b5495  Skip testing whether the HTTP body indicates a whisk failure 
result while command is 'wsk action invoke NNN --result' (#52)
d3b5495 is described below

commit d3b5495baa386ebaeaeef46e4f18fdd85758dc14
Author: jiangpch <jiangpengch...@navercorp.com>
AuthorDate: Wed Jan 3 22:32:27 2018 +0800

    Skip testing whether the HTTP body indicates a whisk failure result while 
command is 'wsk action invoke NNN --result' (#52)
    
    Closes: #51
---
 whisk/client.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/whisk/client.go b/whisk/client.go
index 8b978ae..b32af63 100644
--- a/whisk/client.go
+++ b/whisk/client.go
@@ -374,10 +374,13 @@ func (c *Client) Do(req *http.Request, v interface{}, 
ExitWithErrorOnTimeout boo
     // Handle 0. HTTP Success + Body indicating a whisk failure result
     //   NOTE: Need to ignore activation records send in response to 'wsk get 
activation NNN` as
     //         these will report the same original error giving the appearance 
that the command failed.
+    //         Need to ignore `wsk action invoke NNN --result` too, otherwise 
action whose result is sth likes
+    //         '{"response": {"key": "value"}}' will return an error to such 
command.
     if (IsHttpRespSuccess(resp) &&                                      // 
HTTP Status == 200
         data!=nil &&                                                    // 
HTTP response body exists
         v != nil &&
         !strings.Contains(reflect.TypeOf(v).String(), "Activation") &&  // 
Request is not `wsk activation get`
+        !(req.URL.Query().Get("result") == "true") &&                   // 
Request is not `wsk action invoke NNN --result`
         !IsResponseResultSuccess(data)) {                               // 
HTTP response body has Whisk error result
         Debug(DbgInfo, "Got successful HTTP; but activation response reports 
an error\n")
         return parseErrorResponse(resp, data, v)

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].

Reply via email to