{"id":49749,"library":"wise-fetch","title":"wise-fetch","description":"A feature-rich wrapper around node-fetch that adds built-in RFC 7234 compliant response caching, proxy support, abortable requests (AbortController), base URL resolution, automatic rejection of non-2xx/304 responses, and strict URL validation. Version 0.4.0-1 (pre-release). Based on make-fetch-happen and node-fetch-npm. Low release cadence (last release ~2019). Differentiates from plain node-fetch by bundling caching (to OS temp dir), proxy (reads npm config), and base URL support out of the box.","status":"maintenance","version":"0.4.0-1","language":"javascript","source_language":"en","source_url":"https://github.com/shinnn/wise-fetch","tags":["javascript","fetch","rich","request","cache","redirect","proxy","promise","reject"],"install":[{"cmd":"npm install wise-fetch","lang":"bash","label":"npm"},{"cmd":"yarn add wise-fetch","lang":"bash","label":"yarn"},{"cmd":"pnpm add wise-fetch","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core HTTP client with caching and proxy support.","package":"make-fetch-happen","optional":false},{"reason":"Response class polyfill used for compatibility.","package":"node-fetch-npm","optional":false}],"imports":[{"note":"Package uses CommonJS module.exports; default import via require is correct. Named import will fail.","wrong":"const { wiseFetch } = require('wise-fetch')","symbol":"wiseFetch","correct":"import wiseFetch from 'wise-fetch'"},{"note":"ESM default import works if using bundler/interop, but CommonJS require is the documented pattern.","wrong":"import { wiseFetch } from 'wise-fetch'","symbol":"wiseFetch (default)","correct":"const wiseFetch = require('wise-fetch')"},{"note":"Options are passed as second argument; all make-fetch-happen options are supported except counter and cacheManager.","wrong":"","symbol":"options","correct":"wiseFetch('url', { baseUrl: '...', proxy: '...' })"}],"quickstart":{"code":"const wiseFetch = require('wise-fetch');\n\n(async () => {\n  try {\n    const response = await wiseFetch('https://api.github.com/repos/shinnn/wise-fetch', {\n      headers: { 'User-Agent': 'wise-fetch-demo' }\n    });\n    const data = await response.json();\n    console.log(data.full_name);\n  } catch (err) {\n    console.error('Request failed:', err.message);\n    if (err.response) {\n      console.error('Status:', err.response.status);\n    }\n  }\n})();","lang":"javascript","description":"Fetches a JSON API, demonstrates error handling for non-2xx responses, and parses JSON body."},"warnings":[{"fix":"Wrap fetch in try/catch and check err.response.status instead of relying on response.ok.","message":"Automatic rejection on non-2xx/304 responses: unlike browser fetch, wiseFetch rejects the promise for 4xx/5xx responses. Catch errors and access err.response to get the response object.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider migrating to native fetch (Node 18+) or node-fetch v3 with manual caching/proxy implementation.","message":"Package uses node-fetch-npm (deprecated) which is a fork of node-fetch v2. It may not receive security updates.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Clear cache manually by deleting temp files if needed. Not configurable.","message":"Caching uses OS temp directory (os.tmpdir()) which may not be persisted across reboots. Cache behavior is RFC 7234 compliant but may cause stale data in long-running processes.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Explicitly set proxy: null to disable proxy, or set proxy option explicitly.","message":"proxy and noProxy options default to npm config values when running as npm script. May produce unexpected proxy behavior outside npm context.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'-1':45 '/304':37 '0.4.0':44 '2019':65 '2xx':36 '7234':19 'abort':25 'abortcontrol':27 'add':14 'around':9 'automat':31 'base':28,49,84 'box':90 'built':16 'built-in':15 'bundl':73 'cach':22,74,95 'cadenc':62 'compliant':20 'config':82 'differenti':66 'dir':78 'featur':6 'feature-rich':5 'fetch':3,12,53,58,71,92 'happen':54 'javascript':91 'last':63 'low':60 'make':52 'make-fetch-happen':51 'node':11,57,70 'node-fetch':10,69 'node-fetch-npm':56 'non':35 'non-2xx':34 'npm':59,81 'os':76 'plain':68 'pre':47 'pre-releas':46 'promis':98 'proxi':23,79,97 'read':80 'redirect':96 'reject':32,99 'releas':48,61,64 'request':26,94 'resolut':30 'respons':21,38 'rfc':18 'rich':7,93 'strict':40 'support':24,86 'temp':77 'url':29,41,85 'valid':42 'version':43 'wise':2 'wise-fetch':1 'wrapper':8","created_at":"2026-06-07T17:03:24.776643+00:00","updated_at":"2026-06-07T17:03:24.776643+00:00","problems":[{"fix":"Use default import: const wiseFetch = require('wise-fetch');","cause":"Attempting to import wiseFetch as a named export (ESM named import) or using it without importing.","error":"TypeError: fetch is not a function"},{"fix":"Add .catch() or try/catch around the fetch call.","cause":"wiseFetch rejects on HTTP error status by default; not catching the rejection.","error":"UnhandledPromiseRejectionWarning: Error: 404 (Not Found) responded by a GET request to ..."},{"fix":"Ensure URL is absolute and correctly formatted. Use baseUrl option for relative URLs.","cause":"Invalid/misspelled URL or network unreachable; wiseFetch performs strict URL validation.","error":"Error: getaddrinfo ENOTFOUND ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/shinnn/wise-fetch#readme","github":"https://github.com/shinnn/wise-fetch","docs":null,"changelog":null,"pypi":null,"npm":"wise-fetch","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}