i18next-http-middleware
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -18,4 +18,20 @@ "use strict"; | ||
if (!found && options.getUrl(req) && options.getUrl(req).indexOf('?')) { | ||
var urlParams = new URLSearchParams(options.getUrl(req).substring(options.getUrl(req).indexOf('?'))); | ||
found = urlParams.get(options.lookupQuerystring); | ||
var lastPartOfUri = options.getUrl(req).substring(options.getUrl(req).indexOf('?')); | ||
if (typeof URLSearchParams !== 'undefined') { | ||
var urlParams = new URLSearchParams(lastPartOfUri); | ||
found = urlParams.get(options.lookupQuerystring); | ||
} else { | ||
var indexOfQsStart = lastPartOfUri.indexOf("".concat(options.lookupQuerystring, "=")); | ||
if (indexOfQsStart > -1) { | ||
var restOfUri = lastPartOfUri.substring(options.lookupQuerystring.length + 2); | ||
if (restOfUri.indexOf('&') < 0) { | ||
found = restOfUri; | ||
} else { | ||
found = restOfUri.substring(0, restOfUri.indexOf('&')); | ||
} | ||
} | ||
} | ||
} | ||
@@ -22,0 +38,0 @@ } |
@@ -12,4 +12,17 @@ export default { | ||
if (!found && options.getUrl(req) && options.getUrl(req).indexOf('?')) { | ||
const urlParams = new URLSearchParams(options.getUrl(req).substring(options.getUrl(req).indexOf('?'))) | ||
found = urlParams.get(options.lookupQuerystring) | ||
const lastPartOfUri = options.getUrl(req).substring(options.getUrl(req).indexOf('?')) | ||
if (typeof URLSearchParams !== 'undefined') { | ||
const urlParams = new URLSearchParams(lastPartOfUri) | ||
found = urlParams.get(options.lookupQuerystring) | ||
} else { | ||
const indexOfQsStart = lastPartOfUri.indexOf(`${options.lookupQuerystring}=`) | ||
if (indexOfQsStart > -1) { | ||
const restOfUri = lastPartOfUri.substring(options.lookupQuerystring.length + 2) | ||
if (restOfUri.indexOf('&') < 0) { | ||
found = restOfUri | ||
} else { | ||
found = restOfUri.substring(0, restOfUri.indexOf('&')) | ||
} | ||
} | ||
} | ||
} | ||
@@ -16,0 +29,0 @@ } |
{ | ||
"name": "i18next-http-middleware", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "type": "module", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63059
1327