mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
fix 'Modify Response' readme section to avoid unnecessary array copying (#1300)
This commit is contained in:
parent
244303b994
commit
d05624167c
@ -501,12 +501,12 @@ data.
|
||||
selfHandleResponse : true
|
||||
};
|
||||
proxy.on('proxyRes', function (proxyRes, req, res) {
|
||||
var body = new Buffer('');
|
||||
proxyRes.on('data', function (data) {
|
||||
body = Buffer.concat([body, data]);
|
||||
var body = [];
|
||||
proxyRes.on('data', function (chunk) {
|
||||
body.push(chunk);
|
||||
});
|
||||
proxyRes.on('end', function () {
|
||||
body = body.toString();
|
||||
body = Buffer.concat(body).toString();
|
||||
console.log("res from proxied server:", body);
|
||||
res.end("my response to cli");
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user