Quellcode durchsuchen

Allow empty params in GET request.

Tatsuhiro Tsujikawa vor 14 Jahren
Ursprung
Commit
bb9ad97c5c
1 geänderte Dateien mit 5 neuen und 3 gelöschten Zeilen
  1. 5 3
      src/json.cc

+ 5 - 3
src/json.cc

@@ -644,12 +644,14 @@ decodeGetParams(const std::string& query)
     } else {
       jsonRequest = '{';
       if(!method.empty()) {
-        strappend(jsonRequest, "\"method\":\"", method, "\",");
+        strappend(jsonRequest, "\"method\":\"", method, "\"");
       }
       if(!id.empty()) {
-        strappend(jsonRequest, "\"id\":\"", id, "\",");
+        strappend(jsonRequest, ",\"id\":\"", id, "\"");
+      }
+      if(!params.empty()) {
+        strappend(jsonRequest, ",\"params\":", jsonParam);
       }
-      strappend(jsonRequest, "\"params\":", jsonParam);
       jsonRequest += '}';
     }
   }