https://kotlinlang.org logo
#ktor
Title
# ktor
j

james

08/30/2021, 8:42 AM
hello, help me please. Why is it 400? Works fine using browser or retrofit2 REQUEST: https://restaurant-api.wolt.fi/v3/venues?lat=60.170187&lon=24.930599 METHOD: HttpMethod(value=GET)  COMMON HEADERS  Accept: application/json Accept-Charset: UTF-8 CONTENT HEADERS Content-Length: 0 BODY Content-Type: null BODY START BODY END RESPONSE: 400 BAD_REQUEST
Copy code
suspend fun getAllVenues(lat: Double, lon: Double): VenueResponse {
    return client.get(BuildConfig.API_URL + "venues") {
        parameter("lat", lat)
        parameter("lon", lon)
    }
}

single {
        HttpClient(Android) {
            install(JsonFeature) {
                serializer = GsonSerializer {
                    setPrettyPrinting()
                    disableHtmlEscaping()
                }
            }
            expectSuccess = false
            install(Logging) {
                logger = Logger.DEFAULT
                level = LogLevel.ALL
            }
        }
    }
a

Aleksei Tirman [JB]

08/30/2021, 2:22 PM
I've created an issue KTOR-3090 to address this problem. I observe such behavior only on Android. As a workaround, please use
OkHttp
engine.
6 Views