A fetch-based engine for the modelproxy library, enabling HTTP requests via the Fetch API. Version 3.0.31 is current. This engine provides timeout, cache (in-memory with optional expiration), and reload features. It is designed to work with the modelproxy proxy system, allowing middleware-like request/response interception. Compared to other engines like AxiosEngine, this one leverages the built-in fetch, reducing dependencies. Release cadence is irregular; updates focus on bug fixes and compatibility.
npm install modelproxy-engine-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes a FetchEngine, adds a middleware to validate HTTP status and response data code, then registers it with modelproxy Proxy.
Use ctx.result.clone() before calling .json() or .text() on the response.
Call await next() in each middleware to continue the pipeline.
Consider migrating to other engines like modelproxy-engine-axios if active maintenance is needed.
Use an external caching layer if persistence is required.
Use ctx.result = await ctx.result.clone(); before reading.
Ensure middleware does not replace ctx.result prematurely; clone and preserve Response type.
Increase timeout via settings: new FetchEngine({ settings: { timeout: 10000 } })