Skip to content

Commit

Permalink
fix: error on non-200 response
Browse files Browse the repository at this point in the history
Non-200 responses are not handled currently.
  • Loading branch information
tmillr committed Aug 23, 2022
1 parent 698e177 commit 36b957e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ function request(url) {
}, 30000);

httpsGet(url, (res) => {
// TODO: Handle 3XX codes/redirects?
if (res.statusCode !== 200)
return reject(new Error(`bad response: ${res.statusCode}`));

res.on("data", (chunk) => {
body += chunk;
});
Expand Down

0 comments on commit 36b957e

Please sign in to comment.