You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using ktor 1.3.2 with CIO engine, when I try to send a get request to URL https://1.0.0.1/dns-query?ct=application/dns-json&cd=false&do=false&type=A&name=google.com by the following code:
an error occurred with the message Exception in thread "main" io.ktor.client.features.ClientRequestException: Client request(https://1.0.0.1/dns-query?ct=application%2Fdns-json&cd=false&do=false&type=A&name=google.com) invalid: 403 Forbidden, but when I try to access this URL by using a browser or postman or even using the old-school URLConnection in java, it works fine and returns the correct response, for example, the code
val url =URL("https://1.0.0.1/dns-query?ct=application/dns-json&cd=false&do=false&type=A&name=google.com")
val conn = url.openConnection() asHttpURLConnection
conn.connect()
val bf =BufferedReader(InputStreamReader(conn.inputStream))
var line:String=""while (bf.readLine().let { if (it ==null) falseelse {line += it; true} }) {
}
println(line)
dylech30th
changed the title
URLConnection works fine but ktor clinet returns 403 forbidden during a get request
URLConnection works fine but ktor client returns 403 forbidden during a get request
Jul 8, 2020
Facing the same issue Fatal Exception: io.ktor.client.features.ClientRequestException: Client request(URL) 403 invalid
and using ktor v1.6.3.
Is this issue fixed? If so, in which version?
I'm using ktor 1.3.2 with
CIO
engine, when I try to send a get request to URLhttps://1.0.0.1/dns-query?ct=application/dns-json&cd=false&do=false&type=A&name=google.com
by the following code:an error occurred with the message
Exception in thread "main" io.ktor.client.features.ClientRequestException: Client request(https://1.0.0.1/dns-query?ct=application%2Fdns-json&cd=false&do=false&type=A&name=google.com) invalid: 403 Forbidden
, but when I try to access this URL by using a browser or postman or even using the old-school URLConnection in java, it works fine and returns the correct response, for example, the codewill print
and everything looks fine
The text was updated successfully, but these errors were encountered: