boolean responseValid()

in generate-badges.groovy [126:142]


boolean responseValid(String url) {
    def get = new URL(url).openConnection()
    get.setRequestProperty('User-Agent', 'curl/7.35.0')
    int rc = get.responseCode
    if (rc == 200) {
        println "Retrieved valid response code ${rc} from ${url}"
        String text = get.inputStream.text
        if (text.contains('inaccessible') || text.contains('not found') || text.contains('not been found')
            || text.contains('invalid') || text.contains('unknown') || text.contains('no tests found')) {
            println "Retrieved invalid response from ${url}"
            return false
            }
        return true
    }
    println "Retrieved invalid response code ${rc} from ${url}"
    return false
}