Skip to content

Commit

Permalink
Fixed an issue where updatejs was not updating due to redirect 302 (#263
Browse files Browse the repository at this point in the history
)

* Fixed an issue where updatejs was not updating due to redirect 302
  • Loading branch information
JamieStivala authored Feb 8, 2024
1 parent e4ef542 commit 89a2e02
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/updatedb.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,10 @@ function check(database, cb) {

function onResponse(response) {
var status = response.statusCode;

if (status !== 200) {

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

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

0 comments on commit 89a2e02

Please sign in to comment.