const getStatusCode = async(url,redirectedUrl = false)=>{
const { statusCode, data, headers } = await curly.get(url);
console.log(statusCode);
if(statusCode === 301){
let redirectUrl = headers[0]['Location'] || headers[0]['location']
await getStatusCode(redirectUrl,true);
}
if(statusCode === 200){
let response = {
statusCode:redirectedUrl?301:200,
redirectUrl:url
};
console.log(response);
return response;
}
return true;
}