I am writing a simple Express API that integrates with the Google Places API and am trying to send a photo of a place to a client, but cannot make it work. The Google Places API response looks something like this:

The response object also contains the headers property. I tried to send the image like this:
router.get('/photo/:photoRef', function (req, res) { var params = { maxwidth: 400, photoreference: req.params.photoRef, key: key }; var url = baseUrl + 'photo?' + querystring.stringify(params); request(url, function (error, response, body) { if (!error && response.statusCode == 200) { res.type(response.headers['content-type']); res.send(response.body); } }); });
but this does not seem to work. I get the following image:

Any help would be greatly appreciated.
source share