https://kotlinlang.org logo
Title
r

Rohan Maity

05/22/2023, 4:19 PM
Hi, I am looking for something similar to
NetworkBehaviour
class in Retrofit in ktor network https://stackoverflow.com/a/35938747 This class basically helps to configure the type of connection and able to return some mock response based on configuration Is there something similar on ktor available
On checking the code of Network Behaviour class, I could say, I can create a custom logic in ktor but if something is available out of the box it would be great
a

Aleksei Tirman [JB]

05/26/2023, 8:31 AM
Unfortunately, no. You may want to use the
HttpSend
plugin to implement the similar functionality.
r

Rohan Maity

05/26/2023, 8:33 AM
Is it possible to publish this as a separate plugin just like HttpSendPlugin??
a

Aleksei Tirman [JB]

05/26/2023, 8:34 AM
Do you mean the
NetworkBehaviour
analog?
r

Rohan Maity

05/26/2023, 8:34 AM
Yes
a

Aleksei Tirman [JB]

05/26/2023, 8:34 AM
Yes
r

Rohan Maity

05/26/2023, 8:35 AM
Cool. Will try to do that
Is there any doc to publish the plugin for ktor?
a

Aleksei Tirman [JB]

05/26/2023, 8:36 AM
By publishing do you mean to make it available for the users?
r

Rohan Maity

05/26/2023, 8:36 AM
Yes
a

Aleksei Tirman [JB]

05/26/2023, 8:37 AM
No, but you can publish it like any other JVM artifact.
r

Rohan Maity

05/26/2023, 8:38 AM
Ok