default to all fields for undefined `headers.fields` for fetch()

fork
Brian White 12 years ago
parent caff5aa764
commit 2029bd9da3

@ -564,13 +564,13 @@ Valid `options` are:
* **headers** - < _mixed_ > - An _array_ of specific headers to retrieve, _boolean_ true to fetch all headers, or an _object_ of the form (**Default:** (no headers)):
* **fields** - < _mixed_ > - An _array_ of specific headers to retrieve or _boolean_ true to fetch all headers.
* **fields** - < _mixed_ > - An _array_ of specific headers to retrieve or _boolean_ true to fetch all headers. **Default:** (all headers)
* **parse** - < _boolean_ > - Parse headers? **Default:** true
* **headersNot** - < _mixed_ > - An _array_ of specific headers to exclude or an _object_ of the form (**Default:** (no headers)):
* **fields** - < _mixed_ > - An _array_ of specific headers to exclude.
* **fields** - < _mixed_ > - An _array_ of specific headers to exclude. **Default:** (all headers)
* **parse** - < _boolean_ > - Parse headers? **Default:** true

@ -996,6 +996,8 @@ ImapConnection.prototype._fetch = function(which, uids, options, what, cb) {
if (Array.isArray(wp.headers))
headers = wp.headers;
else if (typeof wp.headers === 'object') {
if (wp.headers.fields === undefined)
wp.headers.fields = true;
if (!Array.isArray(wp.headers.fields)
&& typeof wp.headers.fields !== 'string'
&& wp.headers.fields !== true)
@ -1026,6 +1028,8 @@ ImapConnection.prototype._fetch = function(which, uids, options, what, cb) {
if (Array.isArray(wp.headersNot))
headers = wp.headersNot;
else if (typeof wp.headersNot === 'object') {
if (wp.headersNot.fields === undefined)
wp.headersNot.fields = true;
if (!Array.isArray(wp.headersNot.fields)
&& typeof wp.headersNot.fields !== 'string'
&& wp.headersNot.fields !== true)

Loading…
Cancel
Save