You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In wittr/server/Server.js. the following block of code that is piping the Flickr Response is not setting the headers.
this._app.get('/photos/:farm-:server-:id-:secret-:type.jpg', (req, res) => {
const flickrUrl = `http://farm${req.params.farm}.staticflickr.com/${req.params.server}/${req.params.id}_${req.params.secret}_${imgSizeToFlickrSuffix[req.params.type]}.jpg`;
const flickrRequest = http.request(flickrUrl, flickrRes => {
flickrRes.pipe(res);
});
flickrRequest.on('error', err => {
// TODO: use a real flickr image as a fallback
res.sendFile('imgs/icon.png', {
root: __dirname + '/../public/'
});
});
flickrRequest.end();
});
This causes the browser to interpret it as text/plain
The flickrRequest actually contains headers that can be set on the Express response headers and I was able to get the content-type and content-length to be set on the response.
I think the fix will be to loop through the flickrRequest headers and set it on the Express Response and I will be happy to submit a PR for it. But I want to check if there is a reason we are not setting the headers in this code.
The text was updated successfully, but these errors were encountered:
bochap
pushed a commit
to bochap/wittr
that referenced
this issue
Jan 17, 2018
In wittr/server/Server.js. the following block of code that is piping the Flickr Response is not setting the headers.
This causes the browser to interpret it as text/plain
The flickrRequest actually contains headers that can be set on the Express response headers and I was able to get the content-type and content-length to be set on the response.
I think the fix will be to loop through the flickrRequest headers and set it on the Express Response and I will be happy to submit a PR for it. But I want to check if there is a reason we are not setting the headers in this code.
The text was updated successfully, but these errors were encountered: