Skip to content

Commit 6a4294c

Browse files
committed
[feature] implement _write and _read
1 parent 4f24664 commit 6a4294c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/caronte/streams/proxy.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,18 @@ ProxyStream.prototype.onFinish = function() {
2929

3030
}
3131

32-
ProxyStream.prototype.onResponse = function() {
33-
32+
ProxyStream.prototype.onResponse = function(proxyRes) {
33+
this.proxyRes = proxyRes;
3434
}
3535

36-
ProxyStream.prototype._read = function() {}
36+
ProxyStream.prototype._write = function(chunk, encoding, callback) {
37+
this.proxyReq.write(chunk, encoding, callback);
38+
};
39+
40+
ProxyStream.prototype._read = function(size) {
41+
var chunk = (this.proxyRes ? this.proxyRes.read(size) : '') || '';
3742

38-
ProxyStream.prototype._write = function() {}
43+
this.push(chunk);
44+
};
3945

4046
require('util').inherits(ForwardStream, Duplex);

0 commit comments

Comments
 (0)