Explicitly throwing an error when the http status used is not 301 or 302

This commit is contained in:
Daniel Zegarra 2023-04-23 18:28:54 +02:00
commit 23d3f063d4

View file

@ -33,7 +33,7 @@ async function buildCache(host) {
}
if(!['301', '302'].includes(httpStatus)) {
httpStatus = '301';
console.warn(`The record "${url}" wants to use the http status code ${httpStatus} which is not allowed (only 301 and 302). Using 301 instead.`);
throw new Error(`The record "${url}" wants to use the http status code ${httpStatus} which is not allowed (only 301 and 302)`);
}
return {
url,