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.
native-request-light
Advanced tools
Readme
Native Request add features like cookies management or 300 redirects.. You can take a look here: https://github.com/ZaralDev/native-request/
Native Request [Light] is a simple module that makes you able to create native node.js requests supports https.
Install the package with npm
npm install native-request-light
Easy
let request = require('native-request-light');
request.request({
url: "http://github.com/",
method: 'POST',
}, function(err, data, status, headers) {
console.log(status); //200
console.log(data); // page content
console.log(headers); // response headers
});
Full
let request = require('native-request-light');
request.request({
url: "http://github.com/",
method: 'POST',
headers: {
authorization: "Token121",
"content-type": "application/json"
}
}, function(err, data, status, headers) {
console.log(status); //200
console.log(data); // page content
console.log(headers); // response headers
});
Options | Required | Type | Parameters | Default |
---|---|---|---|---|
url | ✓ | String | Target url | |
method | ✓ | String | HTTP method to use. More info here | |
Headers | JSON Object | Pass headers to the request with a JSON format. |
let request = require('native-request-light');
request.get('https://github.com', function(err, data, status, headers) {
if (err) {
throw err;
}
console.log(status); //200
console.log(data); // page content
console.log(headers); // response headers
});
To add custom headers just do like this:
let request = require('native-request-light');
let headers = {
"content-type": "plain/text"
}
request.get('https://github.com', headers, function(err, data, status, headers) {
if (err) {
throw err;
}
console.log(status); //200
console.log(data); // page content
console.log(headers); // response headers
});
request.post(path, callback)
request.post(path, data, callback)
request.post(path, data, headers, callback)
To send an empty post:
let request = require('native-request-light');
request.post('https://github.com', function(err, data, status, headers) {
if (err) {
throw err;
}
console.log(status); //200
console.log(data); // page content
console.log(headers); // response headers
});
With headers and data:
let request = require('native-request-light');
let data = {
"example": true,
}
let headers = {
"content-type": "plain/text"
}
request.post('https://github.com', data, headers, function(err, data, status, headers) {
if (err) {
throw err;
}
console.log(status); //200
console.log(data); // page content
console.log(headers); // response headers
});
MIT. Copyright (c) Samuel Marchese.
FAQs
A light version of native-request - A simple package with no dependencies for native requests using callback
The npm package native-request-light receives a total of 1 weekly downloads. As such, native-request-light popularity was classified as not popular.
We found that native-request-light 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.