Re: [nodejs] Piping gzipped responses?

2012-09-27 Thread Dave Kuhn
The request lib will automatically decompress the response for you. I think 
you'd be better off using http.request or http.get directly and avoiding any 
possible double handling. You can still pipe the response as you are now.

-- 
Dave Kuhn
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Thursday, September 27, 2012 at 2:05 PM, Jamison Dance wrote:

> I have an Express server with a route that just proxies a request to
> another server and pipes it back to the client. It looks like this:
> 
> var request = require('request');
> function('/whatever', function(req, res) {
> request.get({url: 'http://example.com/someGzippedThing', json:
> true}).pipe(res);
> });
> 
> If I hit http://example.com/someGzippedThing, the response is gzipped.
> However, when I hi the /whatever route of my own server, the response
> is not gzipped. How can I make sure it stays gzipped when it gets
> piped back to the client?
> 
> -- 
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: 
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
> 
> 


-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


[nodejs] Piping gzipped responses?

2012-09-27 Thread Jamison Dance
I have an Express server with a route that just proxies a request to
another server and pipes it back to the client. It looks like this:

var request = require('request');
function('/whatever', function(req, res) {
  request.get({url: 'http://example.com/someGzippedThing', json:
true}).pipe(res);
});

If I hit http://example.com/someGzippedThing, the response is gzipped.
However, when I hi the /whatever route of my own server, the response
is not gzipped. How can I make sure it stays gzipped when it gets
piped back to the client?

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en