I found the problem. I was using the wrong import. I had:
import io.ktor.http.headers
But it should be:
import io.ktor.client.request.headers