This is an automated email from the ASF dual-hosted git repository. glynnbird pushed a commit to branch standard in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git
commit d514875f44312ae2d6eb8a9656f4acab34945fbd Author: Glynn Bird <[email protected]> AuthorDate: Thu Aug 16 15:50:59 2018 +0100 test fix-up --- README.md | 4 ++-- lib/nano.js | 2 +- tests/helpers/integration.js | 4 ++-- tests/integration/design/atomic.js | 8 ++++---- tests/integration/shared/cookie.js | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 746374a..02b0476 100644 --- a/README.md +++ b/README.md @@ -963,10 +963,10 @@ alice.findAsStream(q).pipe(process.stdout); ## using cookie authentication -Nano supports making requests using CouchDB's [cookie authentication](http://guide.couchdb.org/editions/1/en/security.html#cookies) functionality. Call `nano.auth` first to get a session cookie. Nano will behave like a web browser, remembering your session cookie and refreshing it if a new one is received in a future HTTP response. +Nano supports making requests using CouchDB's [cookie authentication](http://guide.couchdb.org/editions/1/en/security.html#cookies) functionality. If you initialise *Nano* so that it is cookie-aware, you may call `nano.auth` first to get a session cookie. Nano will behave like a web browser, remembering your session cookie and refreshing it if a new one is received in a future HTTP response. ```js -const nano = require('nano')('http://localhost:5984'), +const nano = require('nano')({url: 'http://localhost:5984', requestDefaults: {jar:true}}), username = 'user', userpass = 'pass', db = nano.db.use('mydb'); diff --git a/lib/nano.js b/lib/nano.js index 8ed61e6..8809f90 100644 --- a/lib/nano.js +++ b/lib/nano.js @@ -47,7 +47,7 @@ module.exports = exports = function dbScope (cfg) { cfg = Object.assign({}, cfg) serverScope.config = cfg - cfg.requestDefaults = cfg.requestDefaults || {jar: true} + cfg.requestDefaults = cfg.requestDefaults || {} const httpAgent = (typeof cfg.request === 'function') ? cfg.request : request.defaults(cfg.requestDefaults) diff --git a/tests/helpers/integration.js b/tests/helpers/integration.js index de2f305..c9432e0 100644 --- a/tests/helpers/integration.js +++ b/tests/helpers/integration.js @@ -164,7 +164,7 @@ helpers.viewDerek = function viewDerek (db, assert, opts, next, method) { }) } -helpers.insertOne = function(assert) { +helpers.insertOne = function (assert) { const db = this.db db.insert({'foo': 'baz'}, 'foobaz', function (err) { assert.equal(err, null, 'should store docs') @@ -172,7 +172,7 @@ helpers.insertOne = function(assert) { }) } -helpers.insertThree = function(assert) { +helpers.insertThree = function (assert) { const db = this.db async.parallel([ function (cb) { db.insert({'foo': 'bar'}, 'foobar', cb) }, diff --git a/tests/integration/design/atomic.js b/tests/integration/design/atomic.js index 0dcbc04..b6666b5 100644 --- a/tests/integration/design/atomic.js +++ b/tests/integration/design/atomic.js @@ -47,7 +47,7 @@ it('should be able to insert atomically', function (assert) { value: 'bar' }) assert.ok(helpers.isPromise(p), 'returns Promise') - p.then(function(response) { + p.then(function (response) { assert.equal(response.foo, 'bar', 'and the right value was set') assert.end() }) @@ -61,7 +61,7 @@ it('should be able to update atomically without a body', function (assert) { }).then(function (response) { assert.equal(response.baz, 'biz', 'and the new field is present') assert.end() - }) + }) }) it('should be able to update with slashes on the id', function (assert) { @@ -69,8 +69,8 @@ it('should be able to update with slashes on the id', function (assert) { assert.ok(helpers.isPromise(p), 'returns Promise') p.then(function (foo) { assert.equal(foo.ok, true, 'response ok') - return db.atomic('update', 'inplace', 'wat/wat', {field: 'wat', value: 'dawg'}) - }).then(function(response) { + return db.atomic('update', 'inplace', 'wat/wat', {field: 'wat', value: 'dawg'}) + }).then(function (response) { assert.equal(response.wat, 'dawg', 'with the right copy') assert.end() }) diff --git a/tests/integration/shared/cookie.js b/tests/integration/shared/cookie.js index a13c05b..cc29156 100644 --- a/tests/integration/shared/cookie.js +++ b/tests/integration/shared/cookie.js @@ -14,7 +14,7 @@ const helpers = require('../../helpers/integration') const harness = helpers.harness(__filename) -const nano = harness.locals.nano +const nano = require('../../../lib/nano.js')({url: 'http://localhost:5984', requestDefaults: {jar: true}}) const it = harness.it it('should be able to create a user', function (assert) {
