What's the preferred library for sending HTTP requ...
# announcements
t
What's the preferred library for sending HTTP requests? I don't need anything fancy, just basic cookie/session functionality and minimal setup
d
ktor-client if you want to use something kotlin-native. Retrofit is pretty good otherwise. There are a bunch of other Java options out there if one of those doesn’t suit your needs.
t
Which Java library would you recommend? It doesn't have to be Kotlin specific if the Java libraries have better docs
I think retrofit is a bit too involved for what I want to do. I just want to write a small script to automate clicking a button on a website
c
Retrofit is a wrapper over OkHttp, which would be my recommendation in that case
But to be honest, I think you’d end up writing less code using Retrofit than you would be using OkHttp directly
👍 1
d
If you want the simplest thing possible, try something like the apache fluent http client. Which is a little bit weak overall but easy to get started with IMO. (OkHttp might also be good for that, I haven’t used it directly before).
t
It seems to me that Retrofit is a lot more "enterprise" and requires more setup. I just need to send a login request, then use the returned session cookie to send another http request. I'll take a look at OkHttp
c
With Retrofit you just have to set up an interface and a class that creates the service using a builder https://square.github.io/retrofit/