We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea228a6 commit 2060ba6Copy full SHA for 2060ba6
api/download.js
@@ -21,14 +21,19 @@ module.exports = (req, res) => {
21
.then((r) => r.json())
22
.then((r) => {
23
const latest = r['dist-tags'].latest;
24
- const link = r.versions[r['dist-tags'].latest].dist.tarball;
+ const selected = req.query.version || latest;
25
+ if (!r.versions[selected]) {
26
+ return res.status(404).end('no such version');
27
+ }
28
+ const link = r.versions[selected].dist.tarball;
29
return fetch(link, {
30
redirect: 'manual',
31
headers: { authorization },
32
}).then((r2) => {
33
res.status(200);
34
return res.json({
35
latest,
36
+ selected,
37
tarball: r2.headers.get('location'),
38
});
39
0 commit comments