default accept-language to en-US when regexp does not match
This commit is contained in:
parent
45d9bdb577
commit
e702022d7f
|
@ -24,7 +24,7 @@ module.exports = function(req, res, next) {
|
|||
req.language = 'en-US';
|
||||
return next();
|
||||
}
|
||||
const langs = header.replace(/\s/g, '').match(acceptLanguages);
|
||||
const langs = header.replace(/\s/g, '').match(acceptLanguages) || ['en-US'];
|
||||
const preferred = langs
|
||||
.map(l => {
|
||||
const parts = l.split(';');
|
||||
|
|
Loading…
Reference in New Issue