mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
KtorRequestsExecutor custom json formatter
This commit is contained in:
parent
b0f7563191
commit
6f04baea4e
@ -29,6 +29,8 @@ must be regular text
|
||||
|
||||
### 0.9.3
|
||||
|
||||
* `KtorRequestsExecutor` now can use custom `JSON` string formatter (by default - non strict)
|
||||
|
||||
### 0.8.5
|
||||
|
||||
* Add extension `String#toMarkdown`
|
||||
|
@ -22,7 +22,8 @@ class KtorRequestsExecutor(
|
||||
hostUrl: String = "https://api.telegram.org",
|
||||
callsFactories: List<KtorCallFactory> = emptyList(),
|
||||
excludeDefaultFactories: Boolean = false,
|
||||
private val requestsLimiter: RequestLimiter = EmptyLimiter
|
||||
private val requestsLimiter: RequestLimiter = EmptyLimiter,
|
||||
private val jsonFormatter: JSON = JSON.nonstrict
|
||||
) : BaseRequestsExecutor(token, hostUrl) {
|
||||
constructor(
|
||||
token: String,
|
||||
@ -59,7 +60,7 @@ class KtorRequestsExecutor(
|
||||
throw IllegalArgumentException("Can't execute request: $request")
|
||||
}
|
||||
val content = call.response.content.toByteArray().toString(Charset.defaultCharset())
|
||||
val responseObject = JSON.parse(
|
||||
val responseObject = jsonFormatter.parse(
|
||||
ResponseParameters.serializer(request.resultSerializer()),
|
||||
content
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user