
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
request-resource
Advanced tools
🚀 🔥 Promise based HTTP client for the browser and node.js
Using npm:
npm install request-resource
Using yarn:
yarn add request-resource
Get resource from an endpoint
import resource from 'request-resource'
resource
.get('https://jsonplaceholder.typicode.com/posts/1')
.then(d => console.log(d))
.catch(e => console.error(e))
// Response ->
/*
{
data: {
body: "quia et suscipit....."
id: 1
title: "sunt aut facere....."
userId: 1
},
headers: {
cache-control: "public, max-age=14400"
content-type: "application/json; charset=utf-8"
expires: "Mon, 12 Nov 2018 20:40:35 GMT"
pragma: "no-cache"
},
statusCode: 200
}
*/
NOTE: async/await is part of ECMAScript 2017 and is not supported in Internet Explorer and older browsers, so use with caution.
Performing a POST request
import resource from 'request-resource'
resource
.post('https://jsonplaceholder.typicode.com/posts', {
title: 'new Post',
body: 'new post body',
})
.then(d => console.log(d))
.catch(e => console.error(e))
url: (String) Resouce endpoint url
formData: (Object) data to be sent as the request body. Only applicable for request methods PUT, POST, and PATCH
config: (Object) configaration object of request-resource library
config object schema
// todo: add moto config to config
{
headers: {
}
}
{
// `data` is the response that was provided by the server
data: {},
// `status` is the HTTP status code from the server response
statusCode: 200,
// `headers` the headers that the server responded with
// All header names are lower cased
headers: {},
}
FAQs
🚀 🔥 Promise based HTTP client for the browser and node.js
The npm package request-resource receives a total of 3 weekly downloads. As such, request-resource popularity was classified as not popular.
We found that request-resource 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.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.