fix(striker-ui-api): handle undefined response in vnc proxy error

main^2
Tsu-ba-me 7 months ago
parent 1a0e3612dc
commit dc4b068a8c
  1. 16
      striker-ui-api/src/middlewares/proxyServerVnc.ts

@ -38,17 +38,21 @@ export const proxyServerVnc = createProxyMiddleware({
error: (error, request, response) => {
perr(`VNC proxy error: ${error}`);
let resType: string;
if (!response) {
perr(`Missing response; got [${response}]`);
return;
}
if ('writeHead' in response) {
resType = 'ServerResponse';
pout('Got ServerResponse object');
response.writeHead(500).end();
} else {
resType = 'Socket';
return response.writeHead(500).end();
}
pout(`Response type = ${resType}`);
pout(`Got Socket object`);
response.end();
},
},
ws: true,

Loading…
Cancel
Save