Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
request-options
Advanced tools
Readme
Default options object generator written in ES6 for the popular NodeJS package Request, providing a generic set of request options
for the request package that can be augmented or overwritten by providing options
.
$ npm install -S request-options
@param {Object} [options]
@returns {Object}
Any valid request options object
These defaults are intended for communication with APIs/services that accept and return JSON:
The defaults can be overwritten by providing your own properties in options
with the new values. Any additional values will be ignored, use the options
object for your extended options.
The basic use case will return true for json and gzip, as well as a timeout of 10 seconds
const requestOptions = require('request-options');
const request = require('request');
function responseHandler (err, res, body) {
// handle request response
}
request(requestOptions(), responseHandler);
// requestOptions => {
json: true,
gzip: true,
timeout: 10000
}
const requestOptions = require('request-options');
const request = require('request');
const options = {
method: 'get',
url: 'https://api.yoursite.com/endpoint'
};
function responseHandler (err, res, body) {
// handle request response
}
request(requestOptions(options), responseHandler);
// requestOptions => {
method: 'get',
url: 'https://api.yoursite.com/endpoint',
json: true,
gzip: true,
timeout: 10000
}
const requestOptions = require('request-options');
const request = require('request');
const options = {
method: 'get',
url: 'https://api.yoursite.com/endpoint'
gzip: false,
timeout: 20000
};
function responseHandler (err, res, body) {
// handle request response
}
request(requestOptions(options), responseHandler);
// requestOptions => {
method: 'get',
url: 'https://api.yoursite.com/endpoint',
json: true,
gzip: false,
timeout: 20000
}
Notice how the default property json
is still present and the value left unchanged
The test suite is located in the test/
directory. All new features are
expected to have corresponding test cases. Ensure that the complete test suite
passes by executing:
$ npm test
Copyright (c) 2017 Nigel Horton
FAQs
Default options object generator for the popular NodeJS package Request
The npm package request-options receives a total of 18 weekly downloads. As such, request-options popularity was classified as not popular.
We found that request-options 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.