Can't seem to override headers while piping a response #633

Closed
vincentwoo opened this Issue Aug 18, 2013 · 2 comments

3 participants

@vincentwoo
dl_req = request.get(remote_url)
dl_req.pipe res

I can't figure out a way to override the Cache-Control policy of remote_url's response. Is this supported by request somewhere? Apologies if it is and I'm just too dumb to figure it out.

@franck34

same here

@mikeal
request member

the "response" event is emitted before pipeDest is called on all destinations. this means that you can just delete any headers on the response object that you don't want to see sent.

var req = request(url)
req.on('response', function (resp) { delete resp.headers['cache-control'] })
req.pipe(resp)
@mikeal mikeal closed this Apr 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment