Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
fix: don't cache npm_service.cnpmjs.org request
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Feb 27, 2019
1 parent 35b3cef commit 65bca46
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions controllers/registry/package/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ module.exports = function* list() {
const name = this.params.name || this.params[0];
// sync request will contain this query params
let noCache = this.query.cache === '0';
if (!noCache) {
const ua = this.headers['user-agent'] || '';
// old sync client will request with these user-agent
if (ua.indexOf('npm_service.cnpmjs.org/') !== -1) {
noCache = true;
}
}
const isJSONPRequest = this.query.callback;
let cacheKey;
let needAbbreviatedMeta = false;
Expand Down

0 comments on commit 65bca46

Please sign in to comment.