Open gigitalz opened 1 month ago
I believe if you pass your own HttpClient to the Translator constructor it should fix the issue. I set a user agent in the default HttpClient in the constructor.
I might not fix this in a timely manner however you are welcome to submit a pull request fixing the issue.
Translator(HttpClient(CIO) {
HttpResponseValidator {
// This is run for all responses
validateResponse { response ->
if (!response.status.isSuccess()) {
throw TranslationException("Error caught from HTTP request: ${response.status}")
}
}
// This is run only when an exception is thrown, including our custom ones
handleResponseExceptionWithRequest { cause, _ ->
if (cause !is TranslationException) {
throw TranslationException("Exception caught from HTTP request", cause)
}
}
})
the above just removes the user agent setup. I don't remember if the user agent was necessary, if it is you would have to figure out how to set the user agent on this new ktor version.
I can't reproduce this issue. Are you still having troubles?
It looks like this breaks with the new KTOR: