integreat-transporter-http
Version:
HTTP transporter for Integreat
23 lines • 804 B
JavaScript
import getHandlersForIncoming from './utils/getHandlersForIncoming.js';
export default (portHandlers) => async function stopListening(connection) {
if (!connection) {
return { status: 'badrequest', error: 'No connection' };
}
const { handlerCase } = connection;
if (!handlerCase) {
return {
status: 'noaction',
warning: 'No incoming handler found for this connection',
};
}
const handlerCases = getHandlersForIncoming(portHandlers, connection.incoming);
if (!handlerCases) {
return {
status: 'noaction',
warning: 'No incoming handler cases found for this connection',
};
}
handlerCases.delete(handlerCase);
return { status: 'ok' };
};
//# sourceMappingURL=stopListening.js.map