Registry / devops / fetch-http-service

fetch-http-service

JSON →
library0.2.1jsnpmunverified

A lightweight HTTP service wrapper around the Fetch API offering get, post, put, patch, and delete methods with query parameter and body support. Current version 0.2.1 is an early release with limited adoption. It simplifies fetch requests by providing a clean, promise-based interface and optional credential/cross-domain flags. Compared to axios or ky, it is minimal and unopinionated but lacks advanced features like interceptors, retries, or timeout handling. Suitable for simple projects or as a learning tool.

npm install fetch-http-service
INSTALL
IMPORT
SIG · FETCH-HTTP-SERVICE
F
fetch-http-service
devopsjavascriptv0.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

get
import { get } from 'fetch-http-service'
const get = require('fetch-http-service').get
ESM-only; no CommonJS support.
post
import { post } from 'fetch-http-service'
import post from 'fetch-http-service'
Named export, not default.
put
import { put } from 'fetch-http-service'
Named export for HTTP PUT.
delete
import { del } from 'fetch-http-service'
import { delete } from 'fetch-http-service'
Uses 'del' as alias because 'delete' is a reserved word.

Demonstrates basic GET with query params and POST with JSON body using the fetch wrapper.

import { get, post } from 'fetch-http-service'; // GET request with query params get('https://api.github.com/search/repositories', { q: 'fetch-http-service', sort: 'stars' }).then(response => { console.log(response); }).catch(err => console.error(err)); // POST request with body post('https://jsonplaceholder.typicode.com/posts', {}, { title: 'foo', body: 'bar', userId: 1 }).then(response => { console.log(response); }).catch(err => console.error(err));
Debug
Known issues
gotcha'delete' method is exported as 'del' because 'delete' is a reserved word in JavaScript.
fix
Use import { del } from 'fetch-http-service' instead of trying to import 'delete'.
affects: >=0.1.0
deprecatedPackage is early version (0.2.1) and may have breaking changes in future releases.
fix
Pin to exact version and test upgrades carefully.
affects: >=0.0.0
gotchaNo built-in error handling for non-2xx HTTP status codes; fetch only rejects on network errors.
fix
Manually check response.ok and throw if needed.
affects: >=0.1.0
gotchaOptions like useCredentials and isCrossDomain may not work as expected in all browsers or Node.js versions.
fix
Test thoroughly or polyfill fetch credentials/ CORS behavior.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: (0 , fetch_http_service.get) is not a function
Importing a named export incorrectly as default or using CommonJS require incorrectly.
fix
Use import { get } from 'fetch-http-service' instead of import get from 'fetch-http-service'.
SyntaxError: The requested module 'fetch-http-service' does not provide an export named 'delete'
Trying to import 'delete' which is a reserved word and not exported under that name.
fix
Use import { del } from 'fetch-http-service' instead.
Error: Request failed with status 404
The package does not throw for HTTP error statuses; fetch treats 404 as a success.
fix
Add manual check: if (!response.ok) throw new Error('HTTP error ' + response.status);
Upgrade
Version history
0.2.1latest on npm
Audit
Dependencies
fetch-http-servicerequiredThe package itself is a runtime dependency.
Agent activity
4 hits · last 30 days
node
4
Resources
fetch-http-service — npm install fetch-http-service · libregistry