Skip to content

Commit

Permalink
Fix headers getter
Browse files Browse the repository at this point in the history
  • Loading branch information
jarda-svoboda committed Apr 15, 2022
1 parent 6a0d1e4 commit b0ff03b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/locale-router-static/src/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const handle = async ({ event, resolve }) => {
// If route locale is not supported
if (!locale) {
// Get user preferred locale
locale = `${`${request.headers['accept-language']}`.match(/[a-zA-Z]+?(?=-|_|,|;)/)}`.toLowerCase();
locale = `${`${request.headers.get('accept-language')}`.match(/[a-zA-Z]+?(?=-|_|,|;)/)}`.toLowerCase();

// Set default locale if user preferred locale does not match
if (!supportedLocales.includes(locale)) locale = defaultLocale;
Expand Down
2 changes: 1 addition & 1 deletion examples/locale-router/src/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const handle = async ({ event, resolve }) => {
// If route locale is not supported
if (!locale) {
// Get user preferred locale
locale = `${`${request.headers['accept-language']}`.match(/[a-zA-Z]+?(?=-|_|,|;)/)}`.toLowerCase();
locale = `${`${request.headers.get('accept-language')}`.match(/[a-zA-Z]+?(?=-|_|,|;)/)}`.toLowerCase();

// Set default locale if user preferred locale does not match
if (!supportedLocales.includes(locale)) locale = defaultLocale;
Expand Down

0 comments on commit b0ff03b

Please sign in to comment.