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": [ 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)}; }) }, {