https://kotlinlang.org logo
#ktor
Title
k

kasper.kondzielski

11/21/2018, 8:49 PM
here is my code:
Copy code
val client = HttpClient()
    install(ContentNegotiation) {
        jackson {
            enable(SerializationFeature.INDENT_OUTPUT)
        }
    }

    runBlocking {
        val buildLog = client.get<HttpResponse>("<https://jitpack.io/com/github/ghostbuster91/gh-webhook-test/f82f1363432678ab9bf4bab325b7af3a78460d35/>")
        println("start")
        println(buildLog.readText())
    }
and after invoking it
buildLog.readText
is empty
e

e5l

11/22/2018, 7:01 AM
Hi, @kasper.kondzielski. It looks like
jitpack
use cloudflare and filters by useragent
Copy code
val log = client.get<String>( "<https://jitpack.io/com/github/ghostbuster91/gh-webhook-test/f82f1363432678ab9bf4bab325b7af3a78460d35/>" ) {
    header(
        HttpHeaders.UserAgent, 
        "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36"
    )
}
println(log)
work for me
k

kasper.kondzielski

11/22/2018, 7:02 AM
Ok thanks I will set it and check if it helps
e

e5l

11/22/2018, 7:03 AM
and
header(HttpHeaders.UserAgent, "curl")
is also works
k

kasper.kondzielski

11/22/2018, 7:05 AM
Although it is interesting that retrofit worked without those headers
e

e5l

11/22/2018, 7:17 AM
Probably it use some by default, and we could introduce default feature for this. Could you file an issue? 🙂
k

kasper.kondzielski

11/22/2018, 7:17 AM
Sure ;)
4 Views