CheckHttpCodeOnly.cs and CheckHttpCodesOnly.cs
Both scripts check for particular HTTP code(s) returned and only those are considered successful. Otherwise, an error alert is generated.
Custom Script File | Arguments |
CheckHttpCodeOnly.cs | “<URL>” <code> <InvertCheck> |
CheckHttpCodesOnly.cs | “<URL>” <list of codes> |
CheckHttpCodeOnly.cs available parameters:
- <URL> – address to monitor.
- <code> – numeric HTTP code.
- additional parameter <InvertCheck> – boolean value, false by default, case sensitive. Use to invert a result of HTTP code monitoring.
Example
CheckHttpCodeOnly.cs "https://www.nytimes.com" 302
<InvertCheck> Examples
If 302 code is returned, the task is considered as successful. Otherwise, an error is generated:
CheckHttpCodeOnly.cs "https://www.google.com/" 302 false
The above is equal to CheckHttpCodeOnly.cs “https://www.google.com/” 302.
If any code other than 500 is returned, the task is considered as successful. Otherwise, an error is generated:
CheckHttpCodeOnly.cs "httpfghzghs://www.google.com/" 500 true
CheckHttpCodesOnly.cs available parameters:
- <URL> – address to monitor.
- <list of codes> – list of numeric HTTP codes separated by gaps.
Example
CheckHttpCodesOnly.cs "https://www.nytimes.com" 302 400 500 304