Skip to content

Commit 89a2e02

Browse files
authored
Fixed an issue where updatejs was not updating due to redirect 302 (#263)
* Fixed an issue where updatejs was not updating due to redirect 302
1 parent e4ef542 commit 89a2e02

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/updatedb.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,10 @@ function check(database, cb) {
181181

182182
function onResponse(response) {
183183
var status = response.statusCode;
184-
185-
if (status !== 200) {
184+
185+
if(status === 301 || status === 302 || status === 303 || status === 307 || status === 308) {
186+
return https.get(getHTTPOptions(response.headers.location), onResponse);
187+
} else if (status !== 200) {
186188
console.log(chalk.red('ERROR') + ': HTTP Request Failed [%d %s]', status, http.STATUS_CODES[status]);
187189
client.abort();
188190
process.exit(1);
@@ -243,7 +245,9 @@ function fetch(database, cb) {
243245
function onResponse(response) {
244246
var status = response.statusCode;
245247

246-
if (status !== 200) {
248+
if(status === 301 || status === 302 || status === 303 || status === 307 || status === 308) {
249+
return https.get(getHTTPOptions(response.headers.location), onResponse);
250+
} else if (status !== 200) {
247251
console.log(chalk.red('ERROR') + ': HTTP Request Failed [%d %s]', status, http.STATUS_CODES[status]);
248252
client.abort();
249253
process.exit(1);

0 commit comments

Comments
 (0)