import {RequestErrorCode, RequestInternalError} from "../request/errors.js"; /** * Sink for `*`, from * ```bnf * response ::= * * ``` * Expects exactly one response */ export async function collectExactOne(source: AsyncIterable): Promise { for await (const response of source) { return response; } throw new RequestInternalError({code: RequestErrorCode.EMPTY_RESPONSE}); }