kittinunf / fuel

The easiest HTTP networking library for Kotlin/Android
https://fuel.gitbook.io/documentation/
MIT License
4.55k stars 428 forks source link

Make it easier to mock Fuel behavior in v3 #859

Open dalewking opened 1 year ago

dalewking commented 1 year ago

For testing purposes one needs to set Fuel up to mock the behavior. You do provide:

    public fun setHttpLoader(loader: HttpLoader)
    public fun setHttpLoader(factory: HttpLoaderFactory)

But those are kind of unusable, since they are all about HttpLoader, which is an actual/expect class and is final so it is not possible to actually create a custom version of HttpLoader.

HttpLoader needs to be an interface. It would be cleaner you instead created a global val defaultHttpLoader that was expect/actual rather than trying to have an expect actual class.

iNoles commented 3 months ago

Should this to be closed?