Skip to content

Commit

Permalink
Fix/129 - Packages 404 (#130)
Browse files Browse the repository at this point in the history
* Checking response body from npm then parsing as necessary Fix #129
  • Loading branch information
dgautsch authored Aug 31, 2018
1 parent db404f9 commit a91329c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function get (name, etag) {
let pkg = redis ? await fetchFromCache(name) : null
if (pkg) return pkg
let req = await HTTP.request(url.resolve(config.uplink.href, '/' + name.replace(/\//, '%2F')), getRequestOpts(etag))
pkg = req.body
pkg = typeof req.body === 'string' ? JSON.parse(req.body) : req.body
if (!pkg.versions) return 404
pkg.etag = req.response.headers.etag
updateCache(pkg)
Expand Down

0 comments on commit a91329c

Please sign in to comment.