New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modified response body #860
Comments
Any updates on this.. |
I am solved this removed |
Use this: |
apiProxy.on('proxyRes', (proxyRes, req, res) => {
var _write = res.write;
var body = '';
proxyRes.on('data', function(data) {
data = data.toString('utf-8');
body += data;
});
res.write = function(data) {
try {
// Modify Body Here
body = body + '<hr>© 2022 Me';
// Don't forget to update Content-Length header
proxyRes.headers['content-length'] = body.length;
_write.call(res, body);
} catch (e) {
console.trace(e);
console.error(e.message);
throw e;
}
};
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem on this part code
When END event is triggered it's too late to change content-length.
The text was updated successfully, but these errors were encountered: