quick fix for requests with no 'accept' header
This commit is contained in:
parent
2c2ae7a348
commit
3dd5cf5228
1 changed files with 18 additions and 8 deletions
|
@ -49,10 +49,15 @@ module.exports = (app) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// serve the file or the show route
|
// serve the file or the show route
|
||||||
const mimetypes = headers['accept'].split(',');
|
if (headers['accept']) { // note: added b/c some requests errored out due to no accept param in header
|
||||||
if (mimetypes.includes('text/html')) {
|
const mimetypes = headers['accept'].split(',');
|
||||||
postToStats('show', originalUrl, ip, 'success');
|
if (mimetypes.includes('text/html')) {
|
||||||
res.status(200).render('showLite', { fileInfo });
|
postToStats('show', originalUrl, ip, 'success');
|
||||||
|
res.status(200).render('showLite', { fileInfo });
|
||||||
|
} else {
|
||||||
|
postToStats('serve', originalUrl, ip, 'success');
|
||||||
|
serveFile(fileInfo, res);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
postToStats('serve', originalUrl, ip, 'success');
|
postToStats('serve', originalUrl, ip, 'success');
|
||||||
serveFile(fileInfo, res);
|
serveFile(fileInfo, res);
|
||||||
|
@ -74,10 +79,15 @@ module.exports = (app) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// serve the file or the show route
|
// serve the file or the show route
|
||||||
const mimetypes = headers['accept'].split(',');
|
if (headers['accept']) { // note: added b/c some requests errored out due to no accept param in header
|
||||||
if (mimetypes.includes('text/html')) {
|
const mimetypes = headers['accept'].split(',');
|
||||||
postToStats('show', originalUrl, ip, 'success');
|
if (mimetypes.includes('text/html')) {
|
||||||
res.status(200).render('showLite', { fileInfo });
|
postToStats('show', originalUrl, ip, 'success');
|
||||||
|
res.status(200).render('showLite', { fileInfo });
|
||||||
|
} else {
|
||||||
|
postToStats('serve', originalUrl, ip, 'success');
|
||||||
|
serveFile(fileInfo, res);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
postToStats('serve', originalUrl, ip, 'success');
|
postToStats('serve', originalUrl, ip, 'success');
|
||||||
serveFile(fileInfo, res);
|
serveFile(fileInfo, res);
|
||||||
|
|
Loading…
Reference in a new issue