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

node-ral

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ral - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

6

lib/ext/protocol/httpProtocolBase.js

@@ -141,2 +141,6 @@ /**

callback && callback(response);
response.emit('extras', {
headers: res.headers,
statusCode: res.statusCode
});
});

@@ -150,3 +154,3 @@

// auto end if no pipe
process.nextTick(function () {
setImmediate(function () {
piped || req.end();

@@ -153,0 +157,0 @@ });

2

lib/ext/protocol/soapProtocol.js

@@ -68,3 +68,3 @@ /**

if (err) {
process.nextTick(function () {
setImmediate(function () {
req.emit('error', err);

@@ -71,0 +71,0 @@ });

@@ -150,2 +150,5 @@ /**

// prevent data invoked after abort
if (me.conf.includeExtras) {
data[me.conf.extrasKey || '_extras'] = me.extras;
}
if (!abort) {

@@ -157,3 +160,3 @@ clearTimeout(me.timeout);

try {
me.emit('data', data);
me.emit('data', data, me.extras);
}

@@ -165,3 +168,3 @@ catch (err) {

else {
me.emit('data', data);
me.emit('data', data, me.extras);
}

@@ -205,2 +208,5 @@ logger.notice('request end ' + ralUtil.qs(me.getLogInfo()));

function unpackResponse() {
response.on('extras', function (extras) {
me.extras = extras;
});
if (context.unpackConverter.isStreamify) {

@@ -340,3 +346,3 @@ unpack = context.unpack(conf);

catch (e) {
return process.nextTick(function () {
return setImmediate(function () {
me.emit('error', e);

@@ -355,3 +361,3 @@ });

}
process.nextTick(function () {
setImmediate(function () {
me.emit('error', err);

@@ -358,0 +364,0 @@ });

{
"name": "node-ral",
"version": "0.4.0",
"version": "0.4.1",
"description": "a rpc client for node",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -140,2 +140,86 @@ /**

it('should get extras data with http', function (done) {
before(function (ok) {
isInited.on('done', ok);
});
var req = ral('GET_QS_SERV', {
data: {
msg: 'hi',
name: '何方石'
}
});
req.on('data', function (data, extras) {
servers.map(function (srv) {
srv.close();
});
extras.statusCode.should.eql(200);
extras.headers['content-type'].should.eql('application/json');
done();
});
req.on('error', function (err) {
(err === null).should.be.true;
servers.map(function (srv) {
srv.close();
});
done();
});
});
it('should get extras in data with includeExtras', function (done) {
before(function (ok) {
isInited.on('done', ok);
});
var req = ral('GET_QS_SERV', {
includeExtras: true,
data: {
msg: 'hi',
name: '何方石'
}
});
req.on('data', function (data) {
servers.map(function (srv) {
srv.close();
});
data._extras.statusCode.should.eql(200);
data._extras.headers['content-type'].should.eql('application/json');
done();
});
req.on('error', function (err) {
(err === null).should.be.true;
servers.map(function (srv) {
srv.close();
});
done();
});
});
it('should support custom extra keys', function (done) {
before(function (ok) {
isInited.on('done', ok);
});
var req = ral('GET_QS_SERV', {
includeExtras: true,
extrasKey: '_extras_',
data: {
msg: 'hi',
name: '何方石'
}
});
req.on('data', function (data) {
servers.map(function (srv) {
srv.close();
});
data._extras_.statusCode.should.eql(200);
data._extras_.headers['content-type'].should.eql('application/json');
done();
});
req.on('error', function (err) {
(err === null).should.be.true;
servers.map(function (srv) {
srv.close();
});
done();
});
});
it('should override the options correctly', function (done) {

@@ -482,3 +566,3 @@ before(function (ok) {

});
req.on('data', function (data) {
req.on('data', function (data, extras) {
data.should.be.eql({

@@ -485,0 +569,0 @@ name: 'hefangshi'

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