Registry / http-networking / react-native-http

react-native-http

JSON →
library0.0.3jsnpmunverified

React Native HTTP is a lightweight HTTP service wrapper for React Native applications, designed to simplify API interactions with built-in JWT token handling. Version 0.0.3 is the latest stable release, but the package appears to be in early development with sparse documentation. It provides an abstract base class HTTPService that supports GET, POST, PUT, DELETE methods with automatic token management (Authorization header, Bearer prefix, storage key). Key differentiators: minimal overhead, token lifecycle handled internally, supports per-request authorization skipping. However, it lacks TypeScript definitions, testing, and a clear roadmap; alternatives like axios or react-native-netinfo are more mature. The project is currently in maintenance mode with infrequent updates.

npm install react-native-http
INSTALL
IMPORT
SIG · REACT-NATIVE-HTTP
R
react-native-http
http-networkingjavascriptv0.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

HTTPService
import { HTTPService } from 'react-native-http'
import HTTPService from 'react-native-http'
Default export is not provided; use named import for HTTPService class.
HTTPService
const HTTPService = require('react-native-http').HTTPService
const HTTPService = require('react-native-http')
CommonJS require must access the named export .HTTPService, not the module itself.
HTTPService
const { HTTPService } = require('react-native-http')
Destructuring require works as well.

Creates a custom API class extending HTTPService with GET and POST methods, then instantiates it and calls getUsers.

import { HTTPService } from 'react-native-http'; class MyAPI extends HTTPService { getUsers() { return this.get('users/'); } createUser(data) { return this.post('users/', data); } } const api = new MyAPI('https://api.example.com'); api.getUsers().then(response => console.log(response)).catch(error => console.error(error));
Debug
Known issues
gotchaThe package relies on react-native AsyncStorage for token storage; if AsyncStorage is removed in newer RN versions, token handling will fail.
fix
Consider switching to @react-native-async-storage/async-storage as a polyfill, or implement custom token storage.
affects: >=0.0.3
gotchaThe skipAuthorization option must be passed as the third parameter to methods (e.g., this.get(path, null, {skipAuthorization: true})). Omitting it or placing it incorrectly will not skip authorization.
fix
Always pass options as the third argument; for GET and DELETE, the second argument (body) should be null if not needed.
affects: >=0.0.3
breakingThe package does not handle network errors gracefully; HTTP errors may reject the promise without detailed status codes.
fix
Wrap calls in try-catch or add .catch handlers to inspect error objects.
affects: >=0.0.3
Errors
Common errors & fixes
TypeError: _reactNativeHttp.default is not a function
Default import used but package only exports named exports.
fix
Use named import: import { HTTPService } from 'react-native-http'
Cannot find module 'react-native-http'
Package is not installed or is in development mode.
fix
Run npm install react-native-http --save
undefined is not an object (evaluating 'this.jwtService.setToken')
JWT token handling requires that the underlying HTTPService sets jwtService before calling methods that expect token.
fix
Ensure the HTTPService constructor is called with a baseURL and that the storageTokenPrefix (default: react_native_http_jwt_token) is set in AsyncStorage.
Upgrade
Version history
0.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
react-native-http — npm install react-native-http · libregistry