소스 검색

Allow empty params in GET request.

Tatsuhiro Tsujikawa 15 년 전
부모
커밋
bb9ad97c5c
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  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 += '}';
     }
   }