Skip to content

Instantly share code, notes, and snippets.

@magnum
Created August 24, 2023 15:41
Show Gist options
  • Save magnum/c010e04c02935ddd292d8421f322de2e to your computer and use it in GitHub Desktop.
Save magnum/c010e04c02935ddd292d8421f322de2e to your computer and use it in GitHub Desktop.
function HTTPResponse( uri ) {
var response_code ;
var options = {
'validateHttpsCertificates' : false
};
try {
response_code = UrlFetchApp .fetch( uri, options ) .getResponseCode() .toString() ;
}
catch( error ) {
response_code = error .toString() //.match( / returned code (\d\d\d)\./ )[1] ;
}
finally {
return response_code ;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment