From 61fb8f7e5b46480e21518589b5511834774adfb2 Mon Sep 17 00:00:00 2001
From: Duddino <duddinogatto@pm.me>
Date: Sat, 12 Nov 2022 18:16:27 +0100
Subject: [PATCH] Added support for true/false

---
 app.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/app.js b/app.js
index 57134f0..a2362fa 100644
--- a/app.js
+++ b/app.js
@@ -43,9 +43,9 @@ async function makeRpc(name, ...params){
 	    const ok = 200;
 	    return { status: ok, response: JSON.stringify(obj.result) };
 	}
-    }catch(error){
+    } catch(error) {
 	if (error.errno === "ECONNREFUSED") {
-	    return { status: 503, response: JSON.stringify({response: "PIVX node was not responsive."})};
+	    return { status: 503, response: "PIVX node was not responsive."};
 	}
 	if (error.name === 'AbortError') {
 	    return "brequbest was aborted'";
@@ -63,8 +63,9 @@ app.get('/:rpc', async function(req, res) {
 	if (allowedRpcs.includes(req.params["rpc"])) {
 
 	    const params = (req.query.params ? req.query.params.split(",") : [])
-		  .map(v=>isNaN(v) ? v : parseInt(v));
-	    
+		  .map(v=>isNaN(v) ? v : parseInt(v))
+        	  .map(v=>v === "true" ? true : v)
+		  .map(v=>v === "false" ? false : v);
 	    const { status, response } = await makeRpc(req.params["rpc"], ...params);
 	    res.status(status).send(response + "");
 	} else {