diff --git a/src/static/js/pad.ts b/src/static/js/pad.ts index 25986a33d..d9cc4e902 100644 --- a/src/static/js/pad.ts +++ b/src/static/js/pad.ts @@ -742,7 +742,7 @@ const pad = { }, asyncSendDiagnosticInfo: () => { const currentUrl = window.location.href; - fetch('../ep/pad/connection-diagnostic-info', { + fetch(`${exports.baseURL}ep/pad/connection-diagnostic-info`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/src/tests/backend/specs/apicalls.ts b/src/tests/backend/specs/apicalls.ts new file mode 100644 index 000000000..5b4060ccb --- /dev/null +++ b/src/tests/backend/specs/apicalls.ts @@ -0,0 +1,23 @@ +'use strict'; + +const common = require('../common'); + +describe(__filename, function () { + this.timeout(30000); + let agent: any; + before(async function () { agent = await common.init(); }); + + describe('/ep/pad/connection-diagnostic-info', function () { + it('POST with valid diagnosticInfo returns 200', async function () { + await agent.post('/ep/pad/connection-diagnostic-info') + .send({diagnosticInfo: {disconnectedMessage: 'socket.io timeout'}}) + .expect(200); + }); + + it('POST without diagnosticInfo returns 400', async function () { + await agent.post('/ep/pad/connection-diagnostic-info') + .send({}) + .expect(400); + }); + }); +});