fix(api-selection): fall back to delivery api for invalid apis
This commit is contained in:
committed by
Benedikt Rötsch
parent
5e55d7b5b4
commit
beb69007ce
5
app.js
5
app.js
@@ -84,6 +84,11 @@ app.use(catchErrors(async function (request, response, next) {
|
|||||||
response.locals.currentApi = apis
|
response.locals.currentApi = apis
|
||||||
.find((api) => api.id === (request.query.api || 'cda'))
|
.find((api) => api.id === (request.query.api || 'cda'))
|
||||||
|
|
||||||
|
// Fall back to delivery api if an invalid API is passed
|
||||||
|
if (!response.locals.currentApi) {
|
||||||
|
response.locals.currentApi = apis.find((api) => api.id === 'cda')
|
||||||
|
}
|
||||||
|
|
||||||
next()
|
next()
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user