Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit 2df1088

Browse files
committed
Improved docs for initialization callback
1 parent acea66a commit 2df1088

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# UNRELEASED
22
- [FIXED] Expose BasePlugin.
3+
- [IMPROVED] Documented the legacy compatibility behaviour that always adds the
4+
`cookieauth` plugin when using the initialization callback functionality.
35

46
# 4.2.2 (2019-10-23)
57
- [FIXED] Stopped disabling the IAM auth plugin after failed IAM

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,25 @@ Cloudant({ account: me, password: password }, function(err, cloudant, pong) {
249249
});
250250
~~~
251251

252+
**Note:** For legacy compatibility with older versions of the library using the
253+
initialization callback will always add the `cookieauth` plugin to the list of
254+
configured plugins. If you do not want to use `cookieauth` then you should not
255+
use this initialization callback, instead initalize the client without a
256+
callback and then call the [ping function](https://console.bluemix.net/docs/services/Cloudant/api/account.html#ping)
257+
e.g.:
258+
259+
```js
260+
const c = new Cloudant({
261+
url: 'http://localhost:5984',
262+
username: 'somebody',
263+
password: 'something',
264+
plugins: [] // disable cookieauth
265+
});
266+
c.ping()
267+
.then(/* do something with response */ console.log)
268+
.catch(/* handle error */ console.log);
269+
```
270+
252271
### Callback Signature
253272

254273
Callback functions receive three arguments:

0 commit comments

Comments
 (0)