I migrated to 2.0 but attaching query parameters with api key in
defaultRequest
seems not to work anymore:
Copy code
HttpClient {
// ...
defaultRequest {
url {
protocol = URLProtocol.HTTPS
host = "<http://api.themoviedb.org|api.themoviedb.org>"
encodedPath = "/3$encodedPath" // prepend API version to path
parametersOf("api_key", "my_api_key_value")
}
}
}
suspend fun getConfiguration(): ApiConfig = client.get("configuration").body()
produces:
Copy code
io.ktor.client.plugins.ClientRequestException: Client request(GET <https://api.themoviedb.org/3/configuration>) invalid: 401 Unauthorized. Text: "{"status_code":7,"status_message":"Invalid API key: You must be granted a valid key.","success":false}