Comparing version 2.7.11 to 2.7.12
@@ -5,2 +5,14 @@ # Change Log | ||
<a name="2.7.12"></a> | ||
## [2.7.12](https://github.com/zkat/pacote/compare/v2.7.11...v2.7.12) (2017-05-16) | ||
### Bug Fixes | ||
* **fetch:** fix default userAgent ([4b9d344](https://github.com/zkat/pacote/commit/4b9d344)) | ||
* **registry:** log failed requests too ([0f23f06](https://github.com/zkat/pacote/commit/0f23f06)) | ||
* **remote:** send a useful pkg id header for remote tarballs ([ac13356](https://github.com/zkat/pacote/commit/ac13356)) | ||
<a name="2.7.11"></a> | ||
@@ -7,0 +19,0 @@ ## [2.7.11](https://github.com/zkat/pacote/compare/v2.7.10...v2.7.11) (2017-05-12) |
@@ -31,12 +31,2 @@ 'use strict' | ||
checkWarnings(res, registry, opts) | ||
res.body.on('end', () => { | ||
const elapsedTime = Date.now() - startTime | ||
const attempt = res.headers.get('x-fetch-attempts') | ||
const attemptStr = attempt && attempt > 1 ? ` attempt #${attempt}` : '' | ||
const cacheStr = res.headers.get('x-local-cache') ? ' (from cache)' : '' | ||
opts.log.http( | ||
'fetch', | ||
`GET ${res.status} ${uri} ${elapsedTime}ms${attemptStr}${cacheStr}` | ||
) | ||
}) | ||
if (res.status >= 400) { | ||
@@ -50,4 +40,6 @@ const err = new Error(`${res.status} ${res.statusText}: ${ | ||
err.spec = opts.spec | ||
logRequest(uri, res, startTime, opts) | ||
throw err | ||
} else { | ||
res.body.on('end', () => logRequest(uri, res, startTime, opts)) | ||
return res | ||
@@ -58,2 +50,13 @@ } | ||
function logRequest (uri, res, startTime, opts) { | ||
const elapsedTime = Date.now() - startTime | ||
const attempt = res.headers.get('x-fetch-attempts') | ||
const attemptStr = attempt && attempt > 1 ? ` attempt #${attempt}` : '' | ||
const cacheStr = res.headers.get('x-local-cache') ? ' (from cache)' : '' | ||
opts.log.http( | ||
'fetch', | ||
`GET ${res.status} ${uri} ${elapsedTime}ms${attemptStr}${cacheStr}` | ||
) | ||
} | ||
function getCacheMode (opts) { | ||
@@ -60,0 +63,0 @@ return opts.offline |
@@ -40,3 +40,7 @@ 'use strict' | ||
'pacote-req-type': 'tarball', | ||
'pacote-pkg-id': `registry:${manifest.name}@${manifest.version}` | ||
'pacote-pkg-id': `registry:${ | ||
spec.type === 'remote' | ||
? spec | ||
: `${manifest.name}@${manifest.version}` | ||
}` | ||
}, | ||
@@ -43,0 +47,0 @@ integrity: manifest._integrity, |
@@ -26,3 +26,3 @@ 'use strict' | ||
this.scope = opts.scope | ||
this.userAgent = opts.userAgent || `${pkg.name}@${pkg.version}/node@{process.version}+${process.arch} (${process.platform})` | ||
this.userAgent = opts.userAgent || `${pkg.name}@${pkg.version}/node@${process.version}+${process.arch} (${process.platform})` | ||
this.where = opts.where | ||
@@ -29,0 +29,0 @@ this.preferOnline = opts.preferOnline |
{ | ||
"name": "pacote", | ||
"version": "2.7.11", | ||
"version": "2.7.12", | ||
"description": "JavaScript package downloader", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
75877
1525