This is the code that I am trying to do but it doesn't work.
val JSON = String.format("application/json; charset=utf-8").toMediaType()
(headers as Map<String, String>).toHeaders()
I did import: import okhttp3.MediaType
What do I need to do to make it recognise the toMediaType and toHeaders methods?
Adding the import to my gradle file to force version 4.7.2 solved it
implementation "com.squareup.okhttp3:okhttp:4.7.2"
The extension functions are in companion objects:
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.Headers.Companion.toHeaders
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With