Skip to content

Commit

Permalink
Merge 03fbd21 into 2bed4c7
Browse files Browse the repository at this point in the history
  • Loading branch information
rhjyy committed Feb 8, 2019
2 parents 2bed4c7 + 03fbd21 commit 2adf490
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Server.prototype._requestListener = function (req, res) {
chunks.push(chunk);
});
source.on('end', function () {
var xml = chunks.join('');
var xml = Buffer.concat(chunks).toString();
var result;
var error;
self._processRequestXml(req, res, xml);
Expand Down
59 changes: 59 additions & 0 deletions test/post-data-concat-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use strict';

var fs = require('fs');
var soap = require('..');
var assert = require('assert');
var http = require('http');


describe('post data concat test', function () {
var server = http.createServer(function (req, res) { });

before(function () {
server.listen(51515);
});

after(function () {
server.close();
});

it('should consider the situation about multi-byte character between two tcp packets', function (done) {
var check = function (a, b) {
if (a && b) {
assert(a === b);
done();
}
};

var wsdl = 'test/wsdl/default_namespace.wsdl';
var xml = fs.readFileSync(wsdl, 'utf8');
var service = {
MyService: {
MyServicePort: {
MyOperation: function (arg) {
check(arg, postdata);
return "0";
}
}
}
};

soap.listen(server, '/wsdl', service, xml);

var postdata = "";
for (var i = 0; i < 20000; i++) {
postdata += "测试";
}

soap.createClient(wsdl, {
endpoint: 'http://localhost:51515/wsdl'
}, function (error, client) {
assert(!error);
client.MyOperation(postdata, function (error, response) {
assert(!error);
});
});

});
});

0 comments on commit 2adf490

Please sign in to comment.