INNER CODE UNIT · TypeScript

consume

logaretm/villus · packages/batch/src/index.ts:41

    async function consume() {
      const pending = operations;
      const body = `[${operations.map(o => o.body).join(',')}]`;
      const fetchOpts = mergeFetchOpts(opContext, { headers: {}, body });
      operations = [];

      if (!fetch) {
        throw new Error('Could not resolve fetch, please provide a fetch function');
      }

      let response: ParsedResponse<unknown>;
      try {
        response = await fetch(opContext.url as string, fetchOpts).then(parseResponse);

        ctx.response = response;
        const resInit: Partial<Response> = {
          ok: response.ok,
          status: response.status,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…