import { StatusCodes } from 'http-status-codes';
+import { AbstractUIServer } from './AbstractUIServer';
+import { UIServerUtils } from './UIServerUtils';
import { BaseError } from '../../exception';
import {
type ProcedureName,
type UIServerConfiguration,
} from '../../types';
import { Constants, Utils, logger } from '../../utils';
-import { AbstractUIServer, UIServerUtils } from '../internal';
const moduleName = 'UIHttpServer';
public sendResponse(response: ProtocolResponse): void {
const [uuid, payload] = response;
try {
- if (this.responseHandlers.has(uuid) === true) {
+ if (this.hasResponseHandler(uuid) === true) {
const res = this.responseHandlers.get(uuid) as ServerResponse;
res
.writeHead(this.responseStatusToStatusCode(payload.status), {
body ?? Constants.EMPTY_FREEZED_OBJECT
)
)
+ .then((protocolResponse: ProtocolResponse) => {
+ if (!Utils.isNullOrUndefined(protocolResponse)) {
+ this.sendResponse(protocolResponse);
+ }
+ })
.catch(Constants.EMPTY_FUNCTION);
});
} else {