title: Custom response with http-proxy-middleware package
body: <p>In our project we're using the "http-proxy-middleware"(<a href="https://www.npmjs.com/package/http-proxy-middleware" rel="nofollow noreferrer">https://www.npmjs.com/package/http-proxy-middleware</a>) npm package for proxy.</p>
  
  <p>There is the "onProxyRes" function to subscribe to http-proxy's event.</p>
  
  <p>And there is an example of that function:</p>
  
  <pre><code>function onProxyRes(proxyRes, req, res) {
    proxyRes.headers['x-added'] = 'foobar' // add new header to response
    delete proxyRes.headers['x-removed'] // remove header from response
  }
  </code></pre>
  
  <p>I'm just interesting is it possible somehow based on proxyRes write changed response in <strong>res</strong> object and do not copy data directly from <strong>proxyRes</strong> object?</p>
  
  <p>Just example:</p>
  
  <p>proxyRes(readable stream contains the following data: {"url": "<a href="http://domain/test" rel="nofollow noreferrer">http://domain/test</a>"}, I'd like to modify that response and have res with data like that: {{"url": "<a href="http://changedDomain/test" rel="nofollow noreferrer">http://changedDomain/test</a>"}} and do not copy data from proxyRes directly</p>