Comparing version 2.22.0 to 2.23.0
15
index.js
@@ -676,4 +676,9 @@ // Copyright 2010-2012 Mikeal Rogers | ||
var addCookie = function (cookie) { | ||
if (self._jar) self._jar.add(new Cookie(cookie)) | ||
else cookieJar.add(new Cookie(cookie)) | ||
if (self._jar){ | ||
if(self._jar.add){ | ||
self._jar.add(new Cookie(cookie)) | ||
} | ||
else cookieJar.add(new Cookie(cookie)) | ||
} | ||
} | ||
@@ -916,3 +921,3 @@ | ||
} | ||
if (dest.setHeader) { | ||
if (dest.setHeader && !dest.headersSent) { | ||
for (var i in response.headers) { | ||
@@ -1145,7 +1150,7 @@ dest.setHeader(i, response.headers[i]) | ||
if (jar === false) { | ||
if (!jar) { | ||
// disable cookies | ||
cookies = false | ||
this._disableCookies = true | ||
} else if (jar) { | ||
} else if (jar && jar.get) { | ||
// fetch cookie from the user defined cookie jar | ||
@@ -1152,0 +1157,0 @@ cookies = jar.get({ url: this.uri.href }) |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "2.22.0", | ||
"version": "2.23.0", | ||
"author": "Mikeal Rogers <mikeal.rogers@gmail.com>", | ||
@@ -13,0 +13,0 @@ "repository": { |
@@ -212,3 +212,3 @@ # Request -- Simplified HTTP request method | ||
* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option. | ||
* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section) | ||
* `jar` - Set to `true` if you want cookies to be remembered for future use, or define your custom cookie jar (see examples section) | ||
* `aws` - object containing aws signing information, should have the properties `key` and `secret` as well as `bucket` unless you're specifying your bucket as part of the path, or you are making a request that doesn't use a bucket (i.e. GET Services) | ||
@@ -318,6 +318,6 @@ * `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options. | ||
``` | ||
Cookies are enabled by default (so they can be used in subsequent requests). To disable cookies set jar to false (either in defaults or in the options sent). | ||
Cookies are disabled by default (else, they would be used in subsequent requests). To enable cookies set jar to true (either in defaults or in the options sent). | ||
```javascript | ||
var request = request.defaults({jar: false}) | ||
var request = request.defaults({jar: true}) | ||
request('http://www.google.com', function () { | ||
@@ -324,0 +324,0 @@ request('http://images.google.com') |
@@ -29,2 +29,3 @@ var request = require('../index'); | ||
followAllRedirects: true, | ||
jar: true, | ||
form: { foo: 'bar' } }, function (er, req, body) { | ||
@@ -31,0 +32,0 @@ if (er) throw er; |
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
199747
55
3257