If a client uses a star (*) in the Accept-Language header accept-language fails with error
TypeError: Cannot read property 'langtag' of null
at AcceptLanguage.parse (/Users/davidlanger/repos/casavi/node_modules/accept-language/Build/Source/AcceptLanguage.js:51:64)
at AcceptLanguage.get (/Users/davidlanger/repos/casavi/node_modules/accept-language/Build/Source/AcceptLanguage.js:36:21)
at /Users/davidlanger/repos/casavi/node_modules/express-request-language/index.js:112:66
An example request would be:
curl -H "accept-language: *" http://localhost
But any combination that uses a star fails, because bcp47 fails matching anything, so returns null. This then causes the error. It also fails if anything else than a known string is used (ie. Accept-Header: X). This should probably not throw an error.
If a client uses a star (
*
) in the Accept-Language header accept-language fails with errorAn example request would be:
But any combination that uses a star fails, because
bcp47
fails matching anything, so returnsnull
. This then causes the error. It also fails if anything else than a known string is used (ie.Accept-Header: X
). This should probably not throw an error.Using
*
is valid by w3c