Comparing version 0.1.3 to 0.2.0
@@ -25,4 +25,2 @@ /** | ||
iconv.extendNodeEncodings(); | ||
function RAL(serviceName, options) { | ||
@@ -74,3 +72,3 @@ return new RalRunner(serviceName, options); | ||
timer.start('talk'); | ||
logger.trace('start retry request'); | ||
logger.warning('start retry request.'); | ||
me.doRequest(payload); | ||
@@ -318,3 +316,3 @@ } | ||
info.errmsg = err.message; | ||
logger.warning('request failed ' + ralUtil.qs(info)); | ||
logger.warning('request failed ' + info.errmsg + ralUtil.qs(info)); | ||
process.nextTick(function () { | ||
@@ -329,3 +327,4 @@ me.emit('error', err); | ||
info.errmsg = err.message; | ||
logger.notice('request failed, try retry. errmsg=' + info.errmsg + ralUtil.qs(info)); | ||
var msg = 'request failed, retry. errmsg=' + info.errmsg + ralUtil.qs(info); | ||
logger.notice(msg); | ||
this.emit('retry', err); | ||
@@ -332,0 +331,0 @@ }; |
{ | ||
"name": "node-ral", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "a rpc client for node", | ||
@@ -151,3 +151,3 @@ "main": "index.js", | ||
"form-data": "0.1.4", | ||
"iconv-lite": "0.4.4", | ||
"iconv-lite": "0.4.13", | ||
"performance-now": "0.1.3", | ||
@@ -157,3 +157,3 @@ "request": "2.40.0", | ||
"underscore": "1.6.0", | ||
"urlencode": "0.2.0", | ||
"urlencode": "1.1.0", | ||
"yog-log": "0.0.x" | ||
@@ -166,5 +166,5 @@ }, | ||
"istanbul": "0.3.0", | ||
"mocha": "1.21.3", | ||
"mocha": "2.3.3", | ||
"should": "4.0.4" | ||
} | ||
} |
@@ -16,2 +16,3 @@ node-ral | ||
- [x] node 0.12.x | ||
- [x] node 4.x | ||
- [x] io.js | ||
@@ -18,0 +19,0 @@ |
@@ -206,2 +206,5 @@ /** | ||
}); | ||
res.on('error', function () { | ||
server.close(); | ||
}); | ||
}); | ||
@@ -228,5 +231,8 @@ pack.pipe(request); | ||
server.close(); | ||
data2.toString().should.be.equal('hear you 张三李四'); | ||
data2.toString().should.be.equal('hear you �������'); | ||
done(); | ||
}); | ||
res.on('error', function () { | ||
server.close(); | ||
}); | ||
}); | ||
@@ -233,0 +239,0 @@ pack.pipe(request); |
@@ -132,3 +132,3 @@ /** | ||
it('should work well with https', function (done) { | ||
(process.env.CI ? it : it.skip)('should work well with https', function (done) { | ||
var getTest = require('./protocol/http_protocol_get_test.js'); | ||
@@ -149,3 +149,3 @@ // start a http server for get | ||
it('should work well with https protocol', function (done) { | ||
(process.env.CI ? it : it.skip)('should work well with https protocol', function (done) { | ||
var getTest = require('./protocol/http_protocol_get_test.js'); | ||
@@ -182,2 +182,5 @@ // start a http server for get | ||
}); | ||
res.on('error', function (data) { | ||
server.close(); | ||
}); | ||
}); | ||
@@ -200,2 +203,6 @@ postTest.request.data.pipe(request); | ||
}); | ||
res.on('error', function (data) { | ||
server.close(); | ||
}); | ||
}); | ||
@@ -216,5 +223,8 @@ postTest.requestWithUrlencode.data.pipe(request); | ||
data.toString().should.be.equal( | ||
'hear you 何方石 with file http_protocol_post_test.js'); | ||
'hear you �η�ʯ with file http_protocol_post_test.js'); | ||
done(); | ||
}); | ||
res.on('error', function (data) { | ||
server.close(); | ||
}); | ||
}); | ||
@@ -290,2 +300,3 @@ postTest.requestGBKForm.data.pipe(request); | ||
}); | ||
}); | ||
@@ -292,0 +303,0 @@ }); |
@@ -75,4 +75,14 @@ /** | ||
var server; | ||
module.exports.createServer = function () { | ||
return http.createServer(function (request, response) { | ||
if (server) { | ||
try { | ||
server.close(); | ||
} | ||
catch (e) {} | ||
server.close = function () {}; | ||
} | ||
server = http.createServer(function (request, response) { | ||
var info = url.parse(request.url); | ||
@@ -108,2 +118,3 @@ var pathname = info.pathname; | ||
}).listen(8934); | ||
return server; | ||
}; |
@@ -17,3 +17,2 @@ /** | ||
var path = require('path'); | ||
iconv.extendNodeEncodings(); | ||
@@ -128,11 +127,35 @@ module.exports.__defineGetter__('service', function () { | ||
var server; | ||
module.exports.closeServer = function () { | ||
if (server) { | ||
try { | ||
server.close(); | ||
} | ||
catch (e) {} | ||
server.close = function () {}; | ||
} | ||
}; | ||
module.exports.createServer = function (encoding) { | ||
return http.createServer(function (request, response) { | ||
module.exports.closeServer(); | ||
server = http.createServer(function (request, response) { | ||
var info = url.parse(request.url); | ||
var pathname = info.pathname; | ||
if (pathname === '/hello' && request.method === 'POST') { | ||
var content = 'hear you'; | ||
var formIn = new formidable.IncomingForm(); | ||
formIn.encoding = encoding || 'utf-8'; | ||
// var decodeStream = iconv.decodeStream(encoding || 'utf-8'); | ||
// decodeStream.headers = request.headers; | ||
// decodeStream.rawHeaders = request.rawHeaders; | ||
// decodeStream.httpVersionMajor = request.httpVersionMajor; | ||
// decodeStream.httpVersionMinor = request.httpVersionMinor; | ||
// decodeStream.httpVersion = request.httpVersion; | ||
// decodeStream.trailers = request.trailers; | ||
// decodeStream.rawTrailers = request.rawTrailers; | ||
// decodeStream.url = request.url; | ||
// decodeStream.method = request.method; | ||
// decodeStream.statusCode = request.statusCode; | ||
// decodeStream.statusMessage = request.statusMessage; | ||
formIn.parse(request, function (err, fields, files) { | ||
var content = 'hear you'; | ||
response.writeHead(200, { | ||
@@ -150,2 +173,3 @@ 'content-type': 'text/plain' | ||
}); | ||
// request.pipe(decodeStream); | ||
} | ||
@@ -166,2 +190,3 @@ else if (pathname === '/error' && request.method === 'POST') { | ||
}).listen(8934); | ||
return server; | ||
}; |
@@ -97,3 +97,3 @@ /** | ||
it('auto updater should be triggered is normalizer need update', function (done) { | ||
(process.env.CI ? it : it.skip)('auto updater should be triggered is normalizer need update', function (done) { | ||
var fake = { | ||
@@ -118,3 +118,3 @@ normalizeConfig: function (conf) { | ||
it('auto updater should work fine 1', function (done) { | ||
(process.env.CI ? it : it.skip)('auto updater should work fine 1', function (done) { | ||
var fake = { | ||
@@ -144,3 +144,3 @@ normalizeConfig: function (conf) { | ||
it('auto updater should work fine 2', function (done) { | ||
(process.env.CI ? it : it.skip)('auto updater should work fine 2', function (done) { | ||
var fake = { | ||
@@ -171,3 +171,3 @@ normalizeConfig: function (conf) { | ||
it('auto updater should not change raw conf', function (done) { | ||
(process.env.CI ? it : it.skip)('auto updater should not change raw conf', function (done) { | ||
var fake = { | ||
@@ -174,0 +174,0 @@ normalizeConfig: function (conf) { |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
291330
8169
153
15
+ Addediconv-lite@0.4.13(transitive)
+ Addedurlencode@1.1.0(transitive)
- Removedaddress@2.0.3(transitive)
- Removediconv-lite@0.2.110.4.4(transitive)
- Removedurlencode@0.2.0(transitive)
- Removedutility@0.1.13(transitive)
Updatediconv-lite@0.4.13
Updatedurlencode@1.1.0