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,6 +49,7 @@ module.exports = (app) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// serve the file or the show route
|
// serve the file or the show route
|
||||||
|
if (headers['accept']) { // note: added b/c some requests errored out due to no accept param in header
|
||||||
const mimetypes = headers['accept'].split(',');
|
const mimetypes = headers['accept'].split(',');
|
||||||
if (mimetypes.includes('text/html')) {
|
if (mimetypes.includes('text/html')) {
|
||||||
postToStats('show', originalUrl, ip, 'success');
|
postToStats('show', originalUrl, ip, 'success');
|
||||||
|
@ -57,6 +58,10 @@ module.exports = (app) => {
|
||||||
postToStats('serve', originalUrl, ip, 'success');
|
postToStats('serve', originalUrl, ip, 'success');
|
||||||
serveFile(fileInfo, res);
|
serveFile(fileInfo, res);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
postToStats('serve', originalUrl, ip, 'success');
|
||||||
|
serveFile(fileInfo, res);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
errorHandlers.handleRequestError('serve', originalUrl, ip, error, res);
|
errorHandlers.handleRequestError('serve', originalUrl, ip, error, res);
|
||||||
|
@ -74,6 +79,7 @@ module.exports = (app) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// serve the file or the show route
|
// serve the file or the show route
|
||||||
|
if (headers['accept']) { // note: added b/c some requests errored out due to no accept param in header
|
||||||
const mimetypes = headers['accept'].split(',');
|
const mimetypes = headers['accept'].split(',');
|
||||||
if (mimetypes.includes('text/html')) {
|
if (mimetypes.includes('text/html')) {
|
||||||
postToStats('show', originalUrl, ip, 'success');
|
postToStats('show', originalUrl, ip, 'success');
|
||||||
|
@ -82,6 +88,10 @@ module.exports = (app) => {
|
||||||
postToStats('serve', originalUrl, ip, 'success');
|
postToStats('serve', originalUrl, ip, 'success');
|
||||||
serveFile(fileInfo, res);
|
serveFile(fileInfo, res);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
postToStats('serve', originalUrl, ip, 'success');
|
||||||
|
serveFile(fileInfo, res);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
errorHandlers.handleRequestError('serve', originalUrl, ip, error, res);
|
errorHandlers.handleRequestError('serve', originalUrl, ip, error, res);
|
||||||
|
|
Loading…
Add table
Reference in a new issue