diff --git a/openvidu-dashboard/dashboard-ce/backend/src/http/errors.ts b/openvidu-dashboard/dashboard-ce/backend/src/http/errors.ts index 213ad8371..9dd3a20a5 100644 --- a/openvidu-dashboard/dashboard-ce/backend/src/http/errors.ts +++ b/openvidu-dashboard/dashboard-ce/backend/src/http/errors.ts @@ -14,7 +14,9 @@ export function errorBody(code: ErrorCode, message: string, details?: Record { - res.status(404).json(errorBody('NOT_FOUND', `No API route for ${req.method} ${req.path}`)); + res.status(404).json( + errorBody('NOT_FOUND', `No API route for ${req.method} ${req.originalUrl.split('?')[0] ?? ''}`) + ); }; interface BodyParserError { diff --git a/openvidu-dashboard/dashboard-ce/backend/test/unit/http-app.test.ts b/openvidu-dashboard/dashboard-ce/backend/test/unit/http-app.test.ts index 99cd0d765..64fc2a42a 100644 --- a/openvidu-dashboard/dashboard-ce/backend/test/unit/http-app.test.ts +++ b/openvidu-dashboard/dashboard-ce/backend/test/unit/http-app.test.ts @@ -57,7 +57,10 @@ describe('HTTP contract', () => { const response = await request(app).get(path); expect(response.status).toBe(404); expect(response.headers['content-type']).toContain('application/json'); - expect((response.body as { error: { code: string } }).error.code).toBe('NOT_FOUND'); + expect((response.body as { error: { code: string; message: string } }).error).toEqual({ + code: 'NOT_FOUND', + message: `No API route for GET ${path}` + }); }); it('hides unexpected errors behind INTERNAL_ERROR', async () => {