Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-rpc-engine

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-rpc-engine - npm Package Compare versions

Comparing version 3.6.0 to 3.6.1

4

package.json
{
"name": "json-rpc-engine",
"version": "3.6.0",
"version": "3.6.1",
"description": "a tool for processing JSON RPC",

@@ -9,3 +9,3 @@ "main": "src/index.js",

"build": "aegir build",
"test": "aegir test",
"test": "npm run test:node",
"test:node": "aegir test --target node",

@@ -12,0 +12,0 @@ "test:browser": "aegir test --target browser",

'use strict'
const async = require('async')
const JsonRpcError = require('json-rpc-error')

@@ -39,5 +38,4 @@ class RpcEngine {

this._runMiddleware(req, res, (err) => {
if (err) return cb(err)
// return response
cb(null, res)
cb(err, res)
})

@@ -109,3 +107,6 @@ }

// prepare error message
res.error = new JsonRpcError.InternalError(err)
res.error = {
code: err.code || -32603,
message: err.stack,
}
// return error-first and res with err

@@ -112,0 +113,0 @@ return onDone(err, res)

@@ -67,2 +67,19 @@ /* eslint-env mocha */

it('erroring middleware test', function (done) {
let engine = new RpcEngine()
engine.push(function (req, res, next, end) {
end(new Error('no bueno'))
})
let payload = { id: 1, jsonrpc: '2.0', method: 'hello' }
engine.handle(payload, function (err, res) {
assert(err, 'did error')
assert(res, 'does have response')
assert(res.error, 'does have error on response')
done()
})
})
it('empty middleware test', function (done) {

@@ -69,0 +86,0 @@ let engine = new RpcEngine()

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc