Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Promisified request library with built in functionality for retries, redirects, and body parsing.
Reqi is a Promisified request library with built in functionality for retries, redirects, and body parsing.
npm install reqi
Using Reqi is like using your favorite request libraries, but with promises. Require reqi
, instantiate a client, and fire away!
const client = new (require('reqi'))({ json: true })
let data = await client.get('https://example.com/posts')
Reqi also includes convience methods for quick requests, such as get
and put
.
;(async function (postNum = 1) {
// create a new reqi client with json parsing
const jsonClient = new (require('reqi'))({ json: true })
try {
// grab a post
let { body } = await jsonClient.get(
`https://jsonplaceholder.typicode.com/posts/${postNum}`
)
// soup up the original post a bit
let shnazzyTitle = body.title.toUpperCase() + '!!!'
let excitingContent = body.body.replace('.', '!')
const recycledPost = {
userId: 1,
id: 1,
title: shnazzyTitle,
body: excitingContent
}
// publish our new post
let res = await jsonClient.put(
`https://jsonplaceholder.typicode.com/posts/${postNum}`,
recycledPost
)
console.log(res.statusCode)
} catch (err) {
console.error(err)
}
})()
See Options for more information regarding clientOptions
and requestOptions
.
clientOptions
: <Object>
See clientOptionsCreates a new client with the supplied clientOptions
overriding defaults.
requestOptions
: <Object>
See requestOptionsbody
: <Object>
| <string>
| <Buffer>
| <stream>
An acceptable request body.url
: <string>
| <URL>
A parsable WHATWG input URL, or URL class.body
: <Object>
| <string>
| <Buffer>
| <stream>
An acceptable request body.clientOptions
: <Object>
redirect
: <boolean>
| <number>
Controls request redirection. If a positive number
is passed, the redirect option will delimit the maximum redirect amount. Upon being set to 'true
', all redirects will be followed.retry
: <boolean>
| <number>
Control request retries. If a positive number
is passed, the retry option will delimit the maximum retry amount. Upon being set to 'true
', retry attempts will be made until a success code is recieved.retryCodes
: number
| <number[]>
HTTP response code(s) to retry upon i.e. 101
or [426, 429]
.maxWait
: <number>
The maximum number of seconds to wait before retrying a request. Deals primarily with rate limits.json
: <boolean>
Enables or disables automatic request and response body parsing. If enabled, 'true
', both bodies sent and recieved by the client are serialized and parsed, respectively.Reqi gives you the option to control retries and redirects, as well as the ability to enable automatic body parsing.
const retryClient = new ReqiClient({ retry: 3, retryCodes: [429] })
By default, retries, redirects, and body parsing are disabled.
Client options are mutable too!
// for example
client.clientOptions.retry = 1
this.clientOptions = {
redirect: false,
retry: false,
retryCodes: [],
maxWait: 3, // seconds
json: false
}
These clientOptions
are bound to the request client and allow for subsequent requests without reconfiguration.
requestOptions
: <Object>
url
: <string>
| <URL>
(Required) A parsable WHATWG input URL, or URL class.Just like what you're used to with Node Core, Reqi supports all core HTTP/HTTPS request options, with a few defaults:
method
: the desired HTTP request method, defaulting to 'GET
'.port
: the desired HTTP host port. If no port is provided, Reqi will use either a 80
or 443
value depending on the request protocol.For more information on the supported requestOptions
, consult the following Node.js documentation:
Licensed under the MIT License. See the LICENSE file for more details.
FAQs
Promisified request library with built in functionality for retries, redirects, and body parsing.
We found that reqi 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.