request-with-cookies
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -5,6 +5,10 @@ var request; | ||
module.exports.createClient = function() { | ||
return request.defaults({ | ||
jar: request.jar() | ||
}); | ||
module.exports.createClient = function(options) { | ||
if (options == null) { | ||
options = {}; | ||
} | ||
if (options.jar == null) { | ||
options.jar = request.jar(); | ||
} | ||
return request.defaults(options); | ||
}; |
{ | ||
"name": "request-with-cookies", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "An enhancement to mikeal/request library to create reusuable clients that supports cookies per client", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -25,2 +25,20 @@ request-with-cookies | ||
You can also create a client with baked in options | ||
```javascript | ||
var request = require("request-with-cookies"); | ||
var options = { | ||
qs: { | ||
q: "foo" | ||
} | ||
}; | ||
var client = request.createClient(options); | ||
// now every request will be sent with "?q=foo" appended to the URL | ||
client("http://www.google.com", function (error, response, body) { | ||
if (!error && response.statusCode == 200) { | ||
console.log(body) // Prints the google web page. | ||
} | ||
}); | ||
``` | ||
## Implementation details | ||
@@ -27,0 +45,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3991
11
64
0