Created
November 13, 2017 22:16
-
-
Save KameronKales/8df25d90dd12a150e2f65d20244ba6db to your computer and use it in GitHub Desktop.
This is the code to check a valid HTTP response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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