|
@@ -42,12 +42,12 @@ export function rewriteKeys(value: unknown): unknown {
|
|
|
* Express middleware that monkey-patches res.json() to rewrite response keys
|
|
* Express middleware that monkey-patches res.json() to rewrite response keys
|
|
|
* from site-based naming back to shop-based naming for backward compatibility.
|
|
* from site-based naming back to shop-based naming for backward compatibility.
|
|
|
*/
|
|
*/
|
|
|
-export function legacyShopAlias(req: Request, res: Response, next?: NextFunction): void {
|
|
|
|
|
|
|
+export function legacyShopAlias(_req: Request, res: Response, next?: NextFunction): void {
|
|
|
const originalJson = res.json.bind(res);
|
|
const originalJson = res.json.bind(res);
|
|
|
|
|
|
|
|
res.json = function (body?: any): Response {
|
|
res.json = function (body?: any): Response {
|
|
|
return originalJson(rewriteKeys(body));
|
|
return originalJson(rewriteKeys(body));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- next?.();
|
|
|
|
|
|
|
+ if (next) next();
|
|
|
}
|
|
}
|