@sap-ux/fe-mockserver-core
Advanced tools
Comparing version 1.4.12 to 1.4.13
@@ -48,9 +48,9 @@ "use strict"; | ||
/** | ||
* Encore single quote as string element so that they cna be matched as well. | ||
* Encode single quotes and asterisks in the string. | ||
* | ||
* @param str | ||
* @param str the string to encode | ||
* @returns the encoded string | ||
*/ | ||
function encode(str) { | ||
return str.replace(/'/g, '%27'); | ||
return str.replaceAll("'", '%27').replaceAll('*', '%2A'); | ||
} | ||
@@ -142,4 +142,11 @@ async function loadMetadata(service, metadataProcessor) { | ||
const subRouter = new router_1.default(); | ||
subRouter.use(`${mockService.urlPath}`, oDataHandlerInstance); | ||
subRouter.use(`${encode(mockService.urlPath)}`, oDataHandlerInstance); | ||
try { | ||
subRouter.use(mockService.urlPath, oDataHandlerInstance); | ||
} | ||
catch { | ||
// Can happen if the URL contains asterisks. As the encoded path is registered below, this might not | ||
// be a problem since clients usually call the encoded path. | ||
log.error(`Could not register service path: ${mockService.urlPath}`); | ||
} | ||
subRouter.use(encode(mockService.urlPath), oDataHandlerInstance); | ||
app.use(/^\/tenant-(\d{1,3})/, subRouter); | ||
@@ -151,4 +158,11 @@ } | ||
} | ||
app.use(`${mockService.urlPath}`, oDataHandlerInstance); | ||
app.use(`${encode(mockService.urlPath)}`, oDataHandlerInstance); | ||
try { | ||
app.use(mockService.urlPath, oDataHandlerInstance); | ||
} | ||
catch { | ||
// Can happen if the URL contains asterisks. As the encoded path is registered below, this might not | ||
// be a problem since clients usually call the encoded path. | ||
log.error(`Could not register path: ${mockService.urlPath}`); | ||
} | ||
app.use(encode(mockService.urlPath), oDataHandlerInstance); | ||
} | ||
@@ -155,0 +169,0 @@ catch (e) { |
{ | ||
"name": "@sap-ux/fe-mockserver-core", | ||
"version": "1.4.12", | ||
"version": "1.4.13", | ||
"description": "SAP Fiori OData - Fiori elements mock server core", | ||
@@ -28,4 +28,4 @@ "repository": { | ||
"router": "2.0.0", | ||
"@sap-ux/annotation-converter": "0.10.0", | ||
"@sap-ux/edmx-parser": "0.9.0" | ||
"@sap-ux/edmx-parser": "0.9.0", | ||
"@sap-ux/annotation-converter": "0.10.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
663187
7719