ThinkJS 3.x wrapper around node-fetch providing an extendable fetch method on controllers. Current version 1.1.2 (stable, low release cadence). It integrates the node-fetch library (v1.x) into ThinkJS's extend system, making fetch available via `this.fetch()` in controller actions. Supports plain text, JSON, file streams, and standard node-fetch options. Key differentiator: it is the official fetch wrapper for ThinkJS 3, simplifying HTTP requests in ThinkJS apps without additional configuration. Only works with ThinkJS 3.x, not standalone. ESM/CJS hybrid; requires CommonJS require due to ThinkJS extend API.
npm install think-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to register think-fetch in the extend config and use this.fetch in a controller to perform HTTP requests.
Upgrade to ThinkJS 3.x or use a compatible version.
Update to a version of think-fetch that uses node-fetch v2 or v3, or replace with direct node-fetch usage.
Ensure fetch is only called inside controller actions where `this` refers to the controller.
Pass `headers: { 'User-Agent': 'custom' }` in fetch options.Prefix relative URLs with the base URL (e.g., `https://example.com/api/foo`).
Add `const fetch = require('think-fetch');` to src/config/extend.js and export it in the array.Use `this.fetch(url, options)` inside controller actions.
Supply a full URL with protocol and host (e.g., 'https://example.com/path').