You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2019/09/09 21:03:06 UTC

[mynewt-newtmgr] branch master updated: res: Interpret all 2xx codes as success

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 5029f07  res: Interpret all 2xx codes as success
5029f07 is described below

commit 5029f07bf173e0f4c935a683d4a9c75a4b7b1428
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Tue Sep 3 13:01:22 2019 -0700

    res: Interpret all 2xx codes as success
    
    Prior to this commit, only 2.05 (Content) was considered success.  All
    other 2xx codes (e.g., Created, Valid, etc.) were treated as failures.
---
 nmxact/xact/res.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/nmxact/xact/res.go b/nmxact/xact/res.go
index 86a9edd..0a434c0 100644
--- a/nmxact/xact/res.go
+++ b/nmxact/xact/res.go
@@ -46,9 +46,11 @@ func newResResult() *ResResult {
 }
 
 func (r *ResResult) Status() int {
-	if r.Rsp.Code() == coap.Content {
+	switch r.Rsp.Code() {
+	case coap.Created, coap.Deleted, coap.Valid, coap.Changed, coap.Content:
 		return 0
-	} else {
+
+	default:
 		return int(r.Rsp.Code())
 	}
 }