{"id":49354,"library":"simple-fetch-wrapper","title":"Simple Fetch Wrapper","description":"simple-fetch-wrapper v1.3.8 is a lightweight HTTP client wrapping the native fetch API. It provides a simple interface for GET and POST requests, base URL configuration, default content type, request interceptors, a fetching status callback, and a custom event system. Updated infrequently, it offers minimal abstraction compared to axios or ky, with TypeScript declarations included. Good for small projects wanting fetch convenience without heavy dependencies.","status":"active","version":"1.3.8","language":"javascript","source_language":"en","source_url":"https://github.com/Chrillaz/simple-fetch-wrapper","tags":["javascript","fetch","http","ajax","typescript"],"install":[{"cmd":"npm install simple-fetch-wrapper","lang":"bash","label":"npm"},{"cmd":"yarn add simple-fetch-wrapper","lang":"bash","label":"yarn"},{"cmd":"pnpm add simple-fetch-wrapper","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package exports default object. CommonJS require works but TypeScript may complain without esModuleInterop.","wrong":"const http = require('simple-fetch-wrapper')","symbol":"default","correct":"import http from 'simple-fetch-wrapper'"},{"note":"setBaseUrl is a method, not a property assignment.","wrong":"http.setBaseUrl = 'https://api.example.com'","symbol":"http.setBaseUrl","correct":"http.setBaseUrl('https://api.example.com')"},{"note":"get returns a Promise; must be awaited.","wrong":"const response = http.get('/users', { params: { id: 1 } })","symbol":"http.get","correct":"const response = await http.get('/users', { params: { id: 1 } })"}],"quickstart":{"code":"import http from 'simple-fetch-wrapper'\n\nhttp.setBaseUrl('https://jsonplaceholder.typicode.com')\nhttp.setDefaultContentType('application/json')\n\nhttp.isFetching((status) => {\n  console.log('Fetching:', status)\n})\n\nconst response = await http.get('/posts/1')\nconsole.log('GET response:', response)\n\nconst postResponse = await http.post('/posts', {\n  body: { title: 'foo', body: 'bar', userId: 1 }\n})\nconsole.log('POST response:', postResponse)","lang":"typescript","description":"Shows base URL setup, content type, fetching status callback, and async GET/POST requests."},"warnings":[{"fix":"Include `params` object in args: http.get('/endpoint', { params: { key: 'value' } })","message":"http.get and http.post do not include query params automatically; must provide via `params` key in args object.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always return the requestConfig object from interceptor function.","message":"http.interceptor must return the modified requestConfig; if forgotten, subsequent requests may fail.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use the callback for UI state updates that can be set repeatedly.","message":"http.isFetching callback receives a boolean but is called multiple times; ensure side effects are idempotent.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use for transient app events only; not a replacement for persistent state management.","message":"Custom events using http.on/http.emit are in-memory and do not persist across page reloads.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'abstract':51 'ajax':74 'api':18 'axio':54 'base':29 'callback':40 'client':13 'compar':52 'configur':31 'content':33 'conveni':67 'custom':43 'declar':59 'default':32 'depend':70 'event':44 'fetch':2,6,17,38,66,72 'get':25 'good':61 'heavi':69 'http':12,73 'includ':60 'infrequ':47 'interceptor':36 'interfac':23 'javascript':71 'ky':56 'lightweight':11 'minim':50 'nativ':16 'offer':49 'post':27 'project':64 'provid':20 'request':28,35 'simpl':1,5,22 'simple-fetch-wrapp':4 'small':63 'status':39 'system':45 'type':34 'typescript':58,75 'updat':46 'url':30 'v1.3.8':8 'want':65 'without':68 'wrap':14 'wrapper':3,7","created_at":"2026-06-07T17:01:19.933538+00:00","updated_at":"2026-06-07T17:01:19.933538+00:00","problems":[{"fix":"Use `import http from 'simple-fetch-wrapper'` or `const http = require('simple-fetch-wrapper').default`","cause":"CommonJS require used without default import; module.exports is an object, not a function.","error":"TypeError: http.get is not a function"},{"fix":"Add `await` before the call: `const res = await http.get(...)`","cause":"Forgetting to await the async http.get or http.post call.","error":"TypeError: Cannot read properties of undefined (reading 'then')"},{"fix":"Call http.setBaseUrl('https://base.url') before making requests.","cause":"Calling http.get or http.post without previously setting a base URL via http.setBaseUrl().","error":"Error: No base URL set. Use setBaseUrl() first."}],"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/Chrillaz/simple-fetch-wrapper#readme","github":"https://github.com/Chrillaz/simple-fetch-wrapper","docs":null,"changelog":null,"pypi":null,"npm":"simple-fetch-wrapper","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","testing"],"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}}