Anyone have an example of making a `HEAD` request ...
# ktor
s
Anyone have an example of making a
HEAD
request with Ktor's
HttpClient
specifically with using CIO engine? This request:
Copy code
httpClient.head<HttpResponse> {
    url {
         protocol = URLProtocol.HTTPS
         host = "<http://www.website.com/trying/to/get/etag/outta/here|www.website.com/trying/to/get/etag/outta/here>"
    }
}
Returns
java.nio.channels.UnresolvedAddressException
only when using CIO engine. When using another engine, e.g. Android, its completes fine. Wondering if there's something special I need to be doing with CIO head requests.
I am using CIO on Android versions >= sdk 24, Android engine on earlier ones, for context
e
Hey @Shan, it looks like you’re trying to set entire
url
to host. Could you try
url("<http://www.website.com/trying/to/get/etag/outta/here|www.website.com/trying/to/get/etag/outta/here>")
instead?
s
Hmm that seems to be working fine. I wonder why it was working with the
host =
using the Android engine? Perhaps appending all the url-related strings differently? anyways, working now, so thanks!
👍 1