We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dc6cc0b commit ea228a6Copy full SHA for ea228a6
1 file changed
api/download.js
@@ -19,14 +19,18 @@ module.exports = (req, res) => {
19
headers: { ...req.headers, authorization },
20
})
21
.then((r) => r.json())
22
- .then((r) => r.versions[r['dist-tags'].latest].dist.tarball)
23
- .then((link) => fetch(link, {
24
- redirect: 'manual',
25
- headers: { authorization },
26
- }))
27
.then((r) => {
28
- res.status(302);
29
- res.setHeader('location', r.headers.get('location'));
30
- return res.end();
+ const latest = r['dist-tags'].latest;
+ const link = r.versions[r['dist-tags'].latest].dist.tarball;
+ return fetch(link, {
+ redirect: 'manual',
+ headers: { authorization },
+ }).then((r2) => {
+ res.status(200);
+ return res.json({
31
+ latest,
32
+ tarball: r2.headers.get('location'),
33
+ });
34
35
});
36
};
0 commit comments