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

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git


The following commit(s) were added to refs/heads/master by this push:
     new d988f6d  res: Don't include payload if none specified
d988f6d is described below

commit d988f6d98990dbf14c505ae56732c25b9d8c4b11
Author: Christopher Collins <ccoll...@apache.org>
AuthorDate: Fri Aug 30 14:18:27 2019 -0700

    res: Don't include payload if none specified
    
    If the user issues a `res` command with no payload (e.g., `res get
    /my/resource`), the outgoing command should not have a payload.
    
    Instead, newtmgr was encoding an empty map as the payload.
---
 newtmgr/cli/res.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/newtmgr/cli/res.go b/newtmgr/cli/res.go
index bee83bf..ae05732 100644
--- a/newtmgr/cli/res.go
+++ b/newtmgr/cli/res.go
@@ -217,6 +217,11 @@ func parsePayload(args []string) ([]byte, error) {
                return nil, err
        }
 
+       if m == nil {
+               // No payload.
+               return nil, nil
+       }
+
        b, err := nmxutil.EncodeCborMap(m)
        if err != nil {
                return nil, err

Reply via email to