New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

shred

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shred - npm Package Compare versions

Comparing version 0.8.8 to 0.8.9

5

lib/shred.js

@@ -36,5 +36,6 @@ // Shred is an HTTP client library intended to simplify the use of Node's

request: function(options) {
options.logger = this.log;
options.logger = options.logger || this.log;
options.logCurl = options.logCurl || this.logCurl;
options.cookieJar = ( 'cookieJar' in options ) ? options.cookieJar : this._sharedCookieJar; // let them set cookieJar = null
// allow users to set cookieJar = null
options.cookieJar = ( 'cookieJar' in options ) ? options.cookieJar : this._sharedCookieJar;
options.agent = options.agent || this.agent;

@@ -41,0 +42,0 @@ // fill in default options

2

lib/shred/content.js

@@ -88,3 +88,3 @@

} else {
return this.processor.stringify(this._body);
return this._body.toString();
}

@@ -91,0 +91,0 @@ },

@@ -61,2 +61,3 @@ // The header mixins allow you to add HTTP header support to any object. This

var setHeader = function(object,name,value) {
$H(object)[name] = value;
$H(object)[corsetCase(name)] = value;

@@ -63,0 +64,0 @@ return object;

@@ -236,2 +236,16 @@ // The request object encapsulates a request, creating a Node.js HTTP request and

enumerable: true
},
// - **sslStrict***. Used to disable to auth check for ssl certificataes,
// set to true to use self signed certs
sslStrict: {
get: function() { return this._sslStrict; },
set: function(sslStrict) {
if(typeof(sslStrict) !== 'boolean')
return this;
this._sslStrict = sslStrict;
return this;
},
enumerable: true
}

@@ -364,2 +378,6 @@ });

request.sslStrict = true;
if(typeof(options.sslStrict) !== undefined){
request.sslStrict = options.sslStrict;
}
};

@@ -372,3 +390,3 @@

var createRequest = function(request) {
var timeout ;
var timeoutId ;

@@ -384,2 +402,3 @@ request.log.debug("Creating request ..");

headers: request.getHeaders(),
rejectUnauthorized: request._sslStrict,
// Node's HTTP/S modules will ignore this, but we are using the

@@ -410,3 +429,3 @@ // browserify-http module in the browser for both HTTP and HTTPS, and this

// timeout so it doesn't fire while we're processing the response.
clearTimeout(timeout);
clearTimeout(timeoutId);

@@ -457,2 +476,4 @@ // Construct a Shred `Response` object from the response. This will stream

request._raw.setMaxListeners( 30 ); // avoid warnings
// We're still setting up the request. Next, we're going to handle error cases

@@ -464,3 +485,3 @@ // where we have no response. We don't emit an error event because that event

request._raw.on("error", function(error) {
request.emitter.emit("request_error", error);
if (!timeoutId) { request.emitter.emit("request_error", error); }
request.emitter.emit("cleanup", error);

@@ -498,7 +519,7 @@ });

if (request.timeout) {
timeout = setTimeout(function() {
timeoutId = setTimeout(function() {
request.log.debug("Timeout fired, aborting request ...");
request._raw.abort();
request.emitter.emit("timeout", request);
},request.timeout);
}, request.timeout);
}

@@ -505,0 +526,0 @@

{
"name":"shred",
"version":"0.8.8",
"description":"A simple HTTP client for nodejs and browsers. Supports gzip, cookies, redirects, and https.",
"name": "shred",
"version": "0.8.9",
"description": "A simple HTTP client for nodejs and browsers. Supports gzip, cookies, redirects, and https.",
"keywords":[

@@ -11,46 +11,29 @@ "http",

{
"type":"MIT",
"url":"https://github.com/automatthew/shred/blob/master/LICENSE"
"type": "MIT",
"url": "https://github.com/automatthew/shred/blob/master/LICENSE"
}
],
"homepage":"https://github.com/automatthew/shred",
"bugs":{
"url":"https://github.com/automatthew/shred/issues"
"homepage": "https://github.com/automatthew/shred",
"bugs": {
"url": "https://github.com/automatthew/shred/issues"
},
"author":{
"name":"Dan Yoder",
"email":"dan@spire.io"
"author": {
"name": "Dan Yoder",
"email": "dan@spire.io"
},
"maintainers":[
{
"name":"Dan Yoder", "email":"dan@spire.io"
},
{
"name":"Jason Campbell", "email":"jason@spire.io"
},
{
"name":"Matthew King", "email":"mking@spire.io"
},
{
"name":"Nicolas LaCasse", "email":"nicolas@spire.io"
}
{ "name": "Dan Yoder", "email": "dan@spire.io" },
{ "name": "Matthew King", "email": "mking@spire.io" }
],
"contributors":[
{
"name":"Dan Yoder", "email":"dyoder@spire.io"
},
{
"name":"Jason Campbell", "email":"jason@spire.io"
},
{
"name":"Matthew King", "email":"mking@spire.io"
},
{
"name":"Andy Burke", "email":"aburke@bitflood.org"
}
{ "name": "Dan Yoder", "email": "dyoder@spire.io" },
{ "name": "Jason Campbell", "email": "jason@spire.io" },
{ "name": "Matthew King", "email": "mking@spire.io" },
{ "name": "Nicolas LaCasse", "email": "nicolas@spire.io" },
{ "name": "Andy Burke", "email": "aburke@bitflood.org" }
],
"main":"./lib/shred.js",
"repository":{
"type":"git",
"url":"git://github.com/automatthew/shred.git"
"main": "./lib/shred.js",
"repository": {
"type": "git",
"url": "git://github.com/automatthew/shred.git"
},

@@ -60,19 +43,23 @@ "files": [

],
"dependencies":{
"sprintf":"0.1.1",
"ax":"0.1.8",
"cookiejar":"1.3.x",
"iconv-lite":">= 0.1.2"
"dependencies": {
"sprintf": "0.1.1",
"ax": "0.1.8",
"cookiejar": "1.3.x",
"iconv-lite": ">= 0.1.2"
},
"devDependencies":{
"testify":"0.1.0",
"express":"2.5.10",
"rephraser":">= 0.1.6",
"browserify":"1.8.3",
"http-browserify":"https://github.com/spire-io/http-browserify/tarball/master",
"uglify-js":">= 1.2.5",
"docco":">= 0.3.0"
"devDependencies": {
"coffee-script": "1.4.x",
"testify": "0.1.0",
"express": "2.5.10",
"rephraser": ">= 0.1.6",
"browserify": "1.8.3",
"http-browserify": "https://github.com/spire-io/http-browserify/tarball/master",
"uglify-js": ">= 1.2.5",
"docco": ">= 0.3.0"
},
"engine":"node >= 0.8.x"
"scripts": {
"test": "node_modules/.bin/cake test"
},
"engine": "node >= 0.8.x"
}

@@ -151,5 +151,42 @@ # Introduction

* `content`: data to send in the body of the request (also aliased to `body`)
* `timeout`: length of time in ms to wait before killing the connection
* `timeout`: length of time in ms (or a date structure with hours/minutes/seconds/millis) to wait before killing the connection
* `proxy`: url of http proxy to use
## Even more examples!
### timeouts
```javascript
var req = shred.get({
url: "http://api.spire.io/",
timeout: 1000, // time out in just 1 second
on: {
response: function(response) {
console.log(response.content.data);
},
// let's watch for a timeout
timeout: function( request ) {
// note: we get the request here, not the response (since there was no response, silly!)
console.log( 'Ooops, we timed out!' );
}
}
});
// or we can pass an object with values like 'minutes', 'seconds' and 'milliseconds'
var req = shred.get({
url: "http://api.spire.io/",
timeout: { minutes: 1, seconds: 30 }, // time out in 1 minute and 30 seconds
on: {
response: function(response) {
console.log(response.content.data);
},
// let's watch for a timeout
timeout: function( request ) {
console.log( 'Ooops, we timed out!' );
}
}
});
```
## Events

@@ -156,0 +193,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc