Registry / devops / art-rest-client

art-rest-client

JSON →
library1.10.3jsnpmunverified

Promise-based HTTP/HTTPS client library for browser and Node.js. Current stable version is 1.10.3. Provides a simple API for JSON and binary requests with CORS support. Uses XMLHttpRequest2 in the browser and the 'xhr2' polyfill in Node.js. Last updated in 2019; no longer actively developed. Offers a minimalist alternative to larger libraries like axios or fetch, but lacks modern features and TypeScript types.

npm install art-rest-client
INSTALL
IMPORT
SIG · ART-REST-CLIENT
A
art-rest-client
devopsjavascriptv1.10.3
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.

default
import RestClient from 'art-rest-client'
const { RestClient } = require('art-rest-client')
The package exports a single function/object as default. Named import will fail.
getJson
import RestClient from 'art-rest-client'; RestClient.getJson(url)
import { getJson } from 'art-rest-client'
Methods are attached to the default export. Destructuring import won't work.
putJson
import RestClient from 'art-rest-client'; RestClient.putJson(url, data)
const { putJson } = require('art-rest-client')
Same as getJson — must use the default import.

Shows how to make a GET request for JSON and then a PUT request to update a resource.

import RestClient from 'art-rest-client'; const url = 'https://jsonplaceholder.typicode.com/users'; RestClient.getJson(url) .then(users => { console.log('Users:', users); const user = users[0]; return RestClient.putJson(`${url}/${user.id}`, { name: 'Updated User' }); }) .then(updatedUser => console.log('Updated user:', updatedUser)) .catch(error => console.error('Error:', error));
Debug
Known issues
deprecatedPackage is no longer actively maintained; consider using fetch or axios for new projects.
fix
Use native fetch in modern environments or axios for a more feature-rich alternative.
affects: >=1.0.0
gotchaIn Node.js, the package uses the xhr2 polyfill which may have limited compatibility with HTTP/2 or newer Node.js versions.
fix
Consider using 'node-fetch' or 'undici' for Node.js HTTP requests.
affects: 1.0.0 - 1.10.3
gotchaThe CORS configuration may require proper server headers; the library does not handle preflight requests automatically.
fix
Ensure your server sends appropriate CORS headers (Access-Control-Allow-Origin, etc.) for cross-origin requests.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: RestClient.getJson is not a function
Using named import instead of default import.
fix
Use 'import RestClient from 'art-rest-client'' instead of 'import { RestClient } from 'art-rest-client''.
XMLHttpRequest is not defined (in Node.js without polyfill)
The package requires XMLHttpRequest which is not available in Node.js by default; it uses xhr2 but that may fail if not installed or loaded.
fix
Ensure xhr2 is installed (it is a dependency) and that your environment is correctly set up. In Node.js < 18, you may need to use a polyfill.
Upgrade
Version history
1.10.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
art-rest-client — npm install art-rest-client · libregistry