Browse Source

minor, fix shellcheck warning

neilpang 8 years ago
parent
commit
671a699472
1 changed files with 4 additions and 4 deletions
  1. 4 4
      dnsapi/dns_dp.sh

+ 4 - 4
dnsapi/dns_dp.sh

@@ -199,7 +199,7 @@ _get_root() {
 
 
 #Usage: method  URI  data
 #Usage: method  URI  data
 _rest() {
 _rest() {
-  m=$1
+  m="$1"
   ep="$2"
   ep="$2"
   data="$3"
   data="$3"
   _debug "$ep"
   _debug "$ep"
@@ -207,11 +207,11 @@ _rest() {
 
 
   _debug url "$url"
   _debug url "$url"
 
 
-  if [ "$data" ]; then
+  if [ "$m" = "GET" ]; then
+    response="$(_get "$url" | tr -d '\r')"
+  else
     _debug2 data "$data"
     _debug2 data "$data"
     response="$(_post "$data" "$url" | tr -d '\r')"
     response="$(_post "$data" "$url" | tr -d '\r')"
-  else
-    response="$(_get "$url" | tr -d '\r')"
   fi
   fi
 
 
   if [ "$?" != "0" ]; then
   if [ "$?" != "0" ]; then