Skip to content

Instantly share code, notes, and snippets.

@KameronKales
Created November 13, 2017 22:16
Show Gist options
  • Select an option

  • Save KameronKales/8df25d90dd12a150e2f65d20244ba6db to your computer and use it in GitHub Desktop.

Select an option

Save KameronKales/8df25d90dd12a150e2f65d20244ba6db to your computer and use it in GitHub Desktop.
This is the code to check a valid HTTP response
function HTTPResponse( uri )
{
var response_code ;
try {
response_code = UrlFetchApp .fetch( uri ) .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