add extra information to proxyReq object
Hi
Before sending request to target server i want to add user information to proxyReq object. Currently target server recieving undefined.
Here is the code snippet
apiProxy.on("proxyReq", function(proxyReq, req, res, options) {
proxyReq.setHeader("Authorization", req.headers['Authorization']);
**proxyReq.userInfo = {email: "vikranth"};**
if (req.body) {
let bodyData = JSON.stringify(req.body);
proxyReq.setHeader("Content-Type", "application/json");
proxyReq.setHeader(
"Content-Length",
Buffer.byteLength(bodyData)
);
proxyReq.write(bodyData);
}
});
proxyReq.userInfo will never send anything to your server.
If you use with the express, req.body will empty if you do not have body-parser middleware