digest-fetch
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -9,7 +9,7 @@ const canRequire = typeof(require) == 'function' | ||
const parse = (raw, field) => { | ||
const parse = (raw, field, trim=true) => { | ||
const regex = new RegExp(`${field}=("[^"]*"|[^,]*)`, "i") | ||
const match = regex.exec(raw) | ||
if (match) | ||
return match[1].replace(/[\s"]/g, '') | ||
return trim ? match[1].replace(/[\s"]/g, '') : match[1] | ||
return null | ||
@@ -138,3 +138,3 @@ } | ||
this.digest.realm = parse(h, 'realm') || '' | ||
this.digest.realm = (parse(h, 'realm', false) || '').replace(/["]/g, '') | ||
@@ -176,4 +176,4 @@ this.digest.qop = this.parseQop(h) | ||
static parse(raw, field) { | ||
return parse(raw, field) | ||
static parse(...args) { | ||
return parse(...args) | ||
} | ||
@@ -180,0 +180,0 @@ } |
{ | ||
"name": "digest-fetch", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "digest auth request plugin for fetch/node-fetch also support http basic auth authentication", | ||
@@ -5,0 +5,0 @@ "main": "digest-fetch-src.js", |
@@ -26,2 +26,7 @@ process.env.NO_DEPRECATION = 'digest-fetch'; | ||
assert.equal(DigestFetch.parse('a="v1,v2"', 'a'), 'v1,v2') | ||
const client = new DigestFetch("", "") | ||
client.parseAuth('qop=auth-int,realm=test') | ||
assert.equal(client.digest.realm, "test") | ||
client.parseAuth('qop="auth",realm="v1 v2"') | ||
assert.equal(client.digest.realm, "v1 v2") | ||
}) | ||
@@ -28,0 +33,0 @@ |
Sorry, the diff of this file is too big to display
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
469669
8614