Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
A high-level HTTP / REST services client for Node.
Install with npm:
$ npm install armrest
Set up a client and issue a GET request:
var armrest = require('armrest');
var github = armrest.client('https://api.github.com');
github.get({
url: '/orgs/:organization',
params: { organization: 'shutterstock' },
success: function(organization) {
// do something
}
});
The armrest.client()
factory takes two forms: send the base URL as a string if that will get you going, or send an object with parameters below for more flexibility.
The base URL, including any or all of the scheme, hostname, port, and path. This option overrides scheme
, hostname
and port
.
The scheme part of the base URL if base
is not specified, either http
or https
. Defaults to http
. Aliased as scheme
as well for compatibility.
The host part of the base URL (hostname
:port
) if base
is not specified.
The hostname part of the base URL if base
is not specified.
The port part of the base URL if base
is not specified.
Number of milliseconds to wait first for establishing the socket connection and sending the request, and then again for receiving the response.
Optional parameter, an object specifying a contentType
, and functions to serialize
and deserialize
request and response bodies.
Instance of some logger that implements debug()
, info()
, warn()
, and error()
.
String indicating criticality of messages to log; one of debug
, info
, warn
, or error
.
Make an HTTP request to the service, given the parameters below.
The path component of the URL. URLs may have sinatra-style interpolation tokens to be filled in by values from params.
Paramaters to be sent with the request. For HEAD, GET and DELETE requests these will be sent as query string parameters. For other HTTP methods, parameters will be serialized according to the serialization scheme associated with the client, and sent in the body of the request.
Callback to be executed upon success, with the deserialized response as the first parameter, followed by the full response object.
Callback to be executed upon failure, with the error as the first parameter, followed by the full response object.
Callback to be executed upon completion, whether the request failed or succeeded, with the error as the first parameter, followed by the full response object, and finally the deserialized response.
When you're working with a number of services at once, use the following alternate interface to configure clients and get easy access for later use.
A class method to register backend services. Send a name for the service, and options expected by the constructor, as detailed above.
var armrest = require('armrest');
armrest.configure('github', {
base: 'http://api.github.com',
timeout: 5000
});
armrest.configure('metacpan', {
base: 'http://api.metacpan.org',
timeout: 5000
});
Later from elsewhere, load in the module and interact with services by name.
var armrest = require('armrest');
armrest.github.get(...);
armrest.metacpan.get(...);
When you're working with a number of client instances and you want them to have the same default behavior, use the following method.
var armrest = require('armrest');
armrest.setDefaults({
timeout: 10000
});
This will set the default timeout for any request to 10000 milliseconds. To clear the default behaviors, use:
armrest.clearDefaults();
This library was developed by David Chester and Zubin Tiku at Shutterstock
Please do! Check out our contributing guide.
MIT © 2012-2017 Shutterstock Images, LLC
FAQs
A high-level HTTP / REST client for Node
The npm package armrest receives a total of 3 weekly downloads. As such, armrest popularity was classified as not popular.
We found that armrest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.