Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 13c113b

Browse files
committed
Fix issue with null payload on inc endpoint
1 parent 522b7b4 commit 13c113b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lib/orbitdb-api.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ class OrbitdbAPI {
177177
method: ['POST', 'PUT'],
178178
path: '/db/{dbname}/inc',
179179
handler: dbMiddleware( async (db, request, _h) => {
180-
return {hash: await db.inc(parseInt(request.payload.val || 1))};
180+
let incval
181+
incval = parseInt(request.payload ? request.payload.val || 1 : 1);
182+
return {hash: await db.inc(incval)};
181183
})
182184
},
183185
{

0 commit comments

Comments
 (0)