From 13c113b0e5760d5504410a84b8ebb76150d8133a Mon Sep 17 00:00:00 2001 From: phillmac Date: Sat, 29 Jun 2019 14:31:11 +1000 Subject: [PATCH 1/2] Fix issue with null payload on inc endpoint --- src/lib/orbitdb-api.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/orbitdb-api.js b/src/lib/orbitdb-api.js index 64a4d24..48f295f 100644 --- a/src/lib/orbitdb-api.js +++ b/src/lib/orbitdb-api.js @@ -177,7 +177,9 @@ class OrbitdbAPI { method: ['POST', 'PUT'], path: '/db/{dbname}/inc', handler: dbMiddleware( async (db, request, _h) => { - return {hash: await db.inc(parseInt(request.payload.val || 1))}; + let incval + incval = parseInt(request.payload ? request.payload.val || 1 : 1); + return {hash: await db.inc(incval)}; }) }, { From dd31f5984aa952c667f8202388da7ce7a85cc8e1 Mon Sep 17 00:00:00 2001 From: phillmac Date: Sat, 29 Jun 2019 14:37:33 +1000 Subject: [PATCH 2/2] Bump version to 0.3.0-rc.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2c4a90e..5162375 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orbit-db-http-api", - "version": "0.3.0-rc.2", + "version": "0.3.0-rc.3", "description": "An HTTP API Server for the OrbitDB distributed peer-to-peer database", "main": "src/cli.js", "keywords": [