A middleware function for de-duplicating fetch requests in the d2l-fetch ecosystem. Version 2.1.1 is the latest. It deduplicates concurrent requests based on url+Authorization header combination, returning a cloned response for duplicate requests. Designed for Brightspace's d2l-fetch library, it is ESM-only and requires a browser environment. Compared to generic dedup patterns, it integrates natively with d2l-fetch's middleware chain.
npm install d2l-fetch-dedupeNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Registers dedupe middleware, then makes two concurrent fetch calls to same URL+auth to demonstrate deduplication.
Use import syntax or ensure your environment supports ES modules.
Ensure requests that should be separate have different URLs or Authorization headers.
Call d2lfetch.use({name:'dedupe', fn: fetchDedupe}) before any fetch calls.Switch to import statement or set type: module in package.json.
Ensure d2l-fetch is correctly imported and d2lfetch is the export from d2l-fetch.
Use `import { fetchDedupe } from 'd2l-fetch-dedupe'`.