Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npm-registry-fetch

Package Overview
Dependencies
Maintainers
2
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-registry-fetch - npm Package Compare versions

Comparing version 3.2.1 to 3.3.0

15

CHANGELOG.md

@@ -5,2 +5,17 @@ # Change Log

<a name="3.3.0"></a>
# [3.3.0](https://github.com/npm/registry-fetch/compare/v3.2.1...v3.3.0) (2018-08-21)
### Bug Fixes
* **query:** stop including undefined keys ([4718b1b](https://github.com/npm/registry-fetch/commit/4718b1b))
### Features
* **otp:** use heuristic detection for malformed EOTP responses ([f035194](https://github.com/npm/registry-fetch/commit/f035194))
<a name="3.2.1"></a>

@@ -7,0 +22,0 @@ ## [3.2.1](https://github.com/npm/registry-fetch/compare/v3.2.0...v3.2.1) (2018-08-16)

16

check-response.js

@@ -73,4 +73,5 @@ 'use strict'

.then(body => {
let parsed = body
try {
body = JSON.parse(body.toString('utf8'))
parsed = JSON.parse(body.toString('utf8'))
} catch (e) {}

@@ -83,16 +84,21 @@ if (res.status === 401 && res.headers.get('www-authenticate')) {

throw new errors.HttpErrorAuthIPAddress(
method, res, body, opts.spec
method, res, parsed, opts.spec
)
} else if (auth.indexOf('otp') !== -1) {
throw new errors.HttpErrorAuthOTP(
method, res, body, opts.spec
method, res, parsed, opts.spec
)
} else {
throw new errors.HttpErrorAuthUnknown(
method, res, body, opts.spec
method, res, parsed, opts.spec
)
}
} else if (res.status === 401 && /one-time pass/.test(body.toString('utf8'))) {
// Heuristic for malformed OTP responses that don't include the www-authenticate header.
throw new errors.HttpErrorAuthOTP(
method, res, parsed, opts.spec
)
} else {
throw new errors.HttpErrorGeneral(
method, res, body, opts.spec
method, res, parsed, opts.spec
)

@@ -99,0 +105,0 @@ }

@@ -59,9 +59,16 @@ 'use strict'

}
const parsed = url.parse(uri)
parsed.search = '?' + qs.stringify(
parsed.query
? Object.assign(qs.parse(parsed.query), q)
: q
)
uri = url.format(parsed)
Object.keys(q).forEach(key => {
if (q[key] === undefined) {
delete q[key]
}
})
if (Object.keys(q).length) {
const parsed = url.parse(uri)
parsed.search = '?' + qs.stringify(
parsed.query
? Object.assign(qs.parse(parsed.query), q)
: q
)
uri = url.format(parsed)
}
}

@@ -68,0 +75,0 @@ return opts.Promise.resolve(body).then(body => fetch(uri, {

{
"name": "npm-registry-fetch",
"version": "3.2.1",
"version": "3.3.0",
"description": "Fetch-based http client for use with npm registry APIs",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc