Skip to content

Commit 19c919f

Browse files
glynnbirdGlynn Bird
and
Glynn Bird
authored
fix cookie handling bug (#320)
Co-authored-by: Glynn Bird <glynnbird@apache.org>
1 parent e14cf05 commit 19c919f

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

lib/nano.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const { CookieJar } = require('tough-cookie')
1919
const cookieJar = new CookieJar()
2020
const stream = require('stream')
2121
const pkg = require('../package.json')
22-
const AGENT_DEFAULTS = { jar: cookieJar, keepAlive: true, maxSockets: 50, keepAliveMsecs: 30000 }
22+
const AGENT_DEFAULTS = { cookies: { jar: cookieJar }, keepAlive: true, maxSockets: 50, keepAliveMsecs: 30000 }
2323
const SCRUBBED_STR = 'XXXXXX'
2424
const defaultHttpAgent = new HttpCookieAgent(AGENT_DEFAULTS)
2525
const defaultHttpsAgent = new HttpsCookieAgent(AGENT_DEFAULTS)

package-lock.json

Lines changed: 18 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"license": "Apache-2.0",
55
"homepage": "http://github.com/apache/couchdb-nano",
66
"repository": "http://github.com/apache/couchdb-nano",
7-
"version": "10.1.0",
7+
"version": "10.1.1",
88
"author": "Apache CouchDB <dev@couchdb.apache.org> (http://couchdb.apache.org)",
99
"keywords": [
1010
"couchdb",
@@ -17,9 +17,9 @@
1717
"database"
1818
],
1919
"dependencies": {
20-
"http-cookie-agent": "^4.0.2",
20+
"http-cookie-agent": "^5.0.2",
2121
"@types/tough-cookie": "^4.0.2",
22-
"axios": "^1.1.3",
22+
"axios": "^1.2.2",
2323
"qs": "^6.11.0",
2424
"tough-cookie": "^4.1.2",
2525
"node-abort-controller": "^3.0.1"

test/nano.auth.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ test('should be able to authenticate - POST /_session - nano.auth', async () =>
2929
const scope = nock(COUCH_URL)
3030
.post('/_session', 'name=u&password=p', { 'content-type': 'application/x-www-form-urlencoded; charset=utf-8' })
3131
.reply(200, response, { 'Set-Cookie': cookie })
32-
.get('/_all_dbs')
32+
.get('/_all_dbs', undefined, { headers: { cookie: c } })
3333
.reply(200, ['a'])
3434

3535
// test POST /_session

0 commit comments

Comments
 (0)