mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
undo regression in tcp-in node (missed one)
and add test
This commit is contained in:
parent
25f4fbf2bb
commit
0398ef3b90
@ -135,7 +135,7 @@ module.exports = function(RED) {
|
||||
buffer = buffer+data;
|
||||
var parts = buffer.split(node.newline);
|
||||
for (var i = 0; i<parts.length-1; i+=1) {
|
||||
msg = {topic:node.topic, payload:parts[i] + node.newline.trimEnd()};
|
||||
msg = {topic:node.topic, payload:parts[i]};
|
||||
msg._session = {type:"tcp",id:id};
|
||||
node.send(msg);
|
||||
}
|
||||
|
@ -121,6 +121,12 @@ describe('TCP in Node', function() {
|
||||
testTCP0(flow, ["foo\nbar"], ["foo", "bar"], done);
|
||||
});
|
||||
|
||||
it('should recv data (Stream/String/Delimiter:o\\n)', function(done) {
|
||||
var flow = [{id:"n1", type:"tcp in", server:"server", host:"localhost", port:port, datamode:"stream", datatype:"utf8", newline:"o\n", topic:"", base64:false, wires:[["n2"]] },
|
||||
{id:"n2", type:"helper"}];
|
||||
testTCP0(flow, ["foo\nbar"], ["fo", "bar"], done);
|
||||
});
|
||||
|
||||
it('should recv data (Stream/String/No delimiter)', function(done) {
|
||||
var flow = [{id:"n1", type:"tcp in", server:"server", host:"localhost", port:port, datamode:"stream", datatype:"utf8", newline:"", topic:"", base64:false, wires:[["n2"]] },
|
||||
{id:"n2", type:"helper"}];
|
||||
|
Loading…
Reference in New Issue
Block a user