
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
Micro Promise based HTTP client for the browser and node.js
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|---|---|---|---|---|---|
| Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
If you intend to support Internet Explorer, be sure to have a poly-fill that adds a global Promise object
Using npm:
$ npm install regrest
Using cdn:
<script src="https://cdn.jsdelivr.net/npm/regrest/lib/index.umd.min.js"></script>
Regrest is designed to be the simplest way possible to make http calls
Performing a GET request
// Import using NodeJS or CommonJS module
const regrest = require("regrest").default;
// Or using ES6 module
import regrest from "regrest";
// Use Promise
regrest
.get("/man/bear/pig")
// Print the raw response string
.then((response) => console.log(response.text))
// Print any error if occurred
.catch((error) => console.log(`*** Error: ${error}`));
// Or use the new async/await keywords
const getGood = async () => {
try {
// Store the response in a variable
const response = await regrest.get("/foo/bar.json");
// print out the parsed response
console.log(response.json);
} catch (error) {
// Print any error if occurred
console.log(`*** Error: ${error}`);
}
};
getGood();
// Or use callbacks
// WE DON'T DO THAT HERE
Performing a POST request
regrest
.post("/comment", JSON.stringify({ name: "Foo", comment: "Bar" }))
.then((response) => console.log(response.status, response.statusText))
.catch((error) => console.log(error));
// Default options are marked with *
const options = {
method: "GET", // *GET, POST, PUT, DELETE, etc.
url: "https://some-domain.com/api/",
headers: { "Content-Type": "application/json; charset=utf-8" }, // *{}
params: { UID: 9873 },
data: JSON.stringify(data), // *null
maxRedirects: 10, // *5
withCredentials: true, // *false, true
};
{
// Contains the status code of the response, e.g. 404 for a not found resource, 200 for a success
status: 200,
// A message related to the status attribute, e.g. OK for a status 200
statusText: "OK",
// The headers that the server responded with
headers: {},
// Response content as a string
text: "",
// Response content as JSON
json: {},
// Response content as Blob on browser and Buffer on Node js
arrayBuffer: instance of Blob || instance of Buffer,
// Reponse content as Blob
blob: instance of Blob
};
regrest.get("/McNullington").catch((error) => {
if (error.response) {
/**
* A request was made but server responded
* with status code out of the 2XX range
* `error.response` is an instance of the response object
*/
console.log(error.response.status);
console.log(error.response.statusText);
console.log(error.response.headers);
// ...
} else if (error.request) {
/**
* A request was made, but no response was received
* `error.request` is an instance of XMLHttpRequest on browser and an instance of
* http.ClientRequest on Node js
*/
console.log(error.request);
} else {
// Something else happened
console.log(error.message);
}
});
FAQs
tiny http client - features rich - modern promise base
We found that regrest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.