Set status to 204 for notifications

This commit is contained in:
Jerko Steiner 2019-07-31 00:53:19 +08:00
parent e16edd5655
commit 401e5b481a
2 changed files with 3 additions and 3 deletions

View File

@ -165,7 +165,7 @@ describe('jsonrpc', () => {
method: 'add', method: 'add',
params: [1, 2], params: [1, 2],
}) })
.expect(200) .expect(204)
.expect('') .expect('')
await request(createApp()) await request(createApp())
@ -176,7 +176,7 @@ describe('jsonrpc', () => {
method: 'add', method: 'add',
params: [1, 2], params: [1, 2],
}) })
.expect(200) .expect(204)
.expect('') .expect('')
}) })
}) })

View File

@ -141,7 +141,7 @@ export function jsonrpc<T, F extends FunctionPropertyNames<T>>(
if (!isPromise(retValue)) { if (!isPromise(retValue)) {
if (isNotification) { if (isNotification) {
return res.send() return res.status(204).send()
} }
return res.json(createSuccessResponse(id, retValue)) return res.json(createSuccessResponse(id, retValue))
} }