
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
An HTTP client library for use in server (restler) and client side (jQuery)
npm install requshar
npm test
Basic method to make a request of any type. The function returns a request instance.
GET request.
POST request.
PUT request.
PATCH request.
DELETE request.
Parse response to json.
method Request method, can be get, post, put, patch and delete. Defaults to 'get'.query Query string variables as a javascript object, will override the querystring in the URL. Defaults to empty.data The data to be added to the body of the request. Default to empty.headers Request headers. Default to empty.parseJSON Enabled parse to json responses. Default to false.defaultErrorCode Error code for internal errors. Default to 598.timeout If set, will emit the timeout event when the response does not return within the said value (in ms).debug Enabled debug mode. Default to false.logger Debbuger. Default to console.onTimeout Function callback for timeout responses.done Function callback for success responses. Default to _.noop.fail Function callback for fail responses. Default to _.noop.For more option see Restler and jQuery.ajax
function callback(err, response, body)
response In server side is the restler response Object. In client side is an object with next properties readyState, responseText, statusCode, statusText, status and res (jQuery response)body Response text. If parseJSON options is true, body is an Object.var Requshar = require('requshar');
var requshar = new Requshar();
var request = requshar.get('http://www.google.com.ar', function(err, res, body) {
if (err instanceof Error) {
console.log('Error:', err.message);
} else {
console.log(body);
}
});
request.req; // Server side restler request instance.
request.req; // Client side jQuery request instance.
var Requshar = require('requshar');
var requshar = new Requshar();
requshar.get('http://www.google.com.ar', function(err, res, body) {
if (err instanceof Error) {
console.log('Error:', err.message);
} else {
console.log(body);
}
});
requshar.post('http://yourpage.com/users', {
data: {
id: 334,
name: 'pepito'
}
}, function(err, res, body) {
if (err instanceof Error) {
console.log('Error:', err.message);
} else {
console.log(body);
}
});
var Requshar = require('requshar');
var requshar = new Requshar({
baseUrl: 'http://www.google.com.ar',
headers: {
'content-type': 'text/plain',
'connection': 'keep-alive',
'accept': '*/*'
}
});
requshar.get('/', function(err, res, body) {
if (err instanceof Error) {
console.log('Error:', err.message);
} else {
console.log(body);
}
});
var logger = require('debug')('requshar');
var Requshar = require('requshar');
var requshar = new Requshar({
debug: true,
logger: logger
});
requshar.get('http://www.google.com.ar', function(err, res, body) {
if (err instanceof Error) {
console.log('Error:', err.message);
} else {
console.log(body);
}
});
<html>
<head>
<meta charset="utf-8">
<title>Requshar in client side</title>
</head>
<body>
<script src="https://cdn.rawgit.com/jquery/jquery/2.1.4/dist/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/jashkenas/underscore/1.8.3/underscore.js"></script>
<script src="https://cdn.rawgit.com/comodinx/requshar/v0.1.3/requshar.js"></script>
<script>
var requshar = new Requshar({
baseUrl: 'https://api.github.com',
debug: true
});
requshar.json('/repos/comodinx/requshar', function(err, res, body) {
if (err instanceof Error) {
alert('Error:' + err.message);
} else {
alert(JSON.stringify(_.pick(body, 'id', 'name', 'full_name', 'language'), null, ' '));
}
});
</script>
</body>
</html>
FAQs
An HTTP client library for use in server (restler) and client side (jQuery)
We found that requshar 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.