<@UDB0VFBPV> I am trying to run test on Fuel 3x on...
# kotlin-fuel
i
@Derk-Jan Karrenbeld I am trying to run test on Fuel 3x on Forge, I get very weird errors from One of deserialize(ByteArray) or deserialize(InputStream) or deserialize(Reader) or deserialize(String) must be implemented
d
Is one of those implemented?
i
Yes
suspend inline fun <reified T : Any> Request.awaitResponseResultObject(noinline deserializer: JSON.() -> DeserializedResult<T>) = awaitResponseResult(forgeDeserializerOf(deserializer))
d
That looks different
i
it supposed to be 🙂
i
it is very tough to see which one occurs 😞
d
You need to either implement
Deserializable
and overwrite
fun deserialize(response: Response): T
, or implement
ResponseDeserializable
and override one of the methods
Copy code
suspend inline fun <reified T : Any> Request.awaitResponseResultObject(noinline deserializer: JSON.() -> DeserializedResult<T>) =
   awaitResponseResult(forgeDeserializerOf(deserializer))
doesn't seem to do either of that?
if I commit it with latest changes, would you figure out why?
💯 1
d
Yes, commit and I'll try to figure out what's wrong!
i
When I did println(String(response.data)), I see json. Odd. Something must be on deserialize
d
Yeah, that is interesting!
i
Now I did override fun deserialize(content: String): T? { println(content) return Forge.modelFromJson(content, deserializer).component1() } I see another json lines.
I think that compontent1() is null, so it throws
d
yeah, null is not valid
I think null = interpreted as no implementation
i
T? is Optional
may be null 🙂
d
can you make it return a "nothing empty object" thing 😛 ?
see if that fixes it, for now?
i
i did val forge = Forge.modelFromJson(content, deserializer) println(forge.compontent2()), it comes up as com.github.kittinunf.forge.core.DeserializedResult$Failure@fe7548
found it com.github.kittinunf.forge.core.PropertyNotFoundException: Property name status is not found
d
so on error you get the INCORRECT error?
on deserialization error you get a weird not implemente error
that's a bug
i
since it is throwing exceptions, it is not catching it and return it as null.
d
got it!
sorry 😞
probably my fault
i
private val httpBinUserDeserializer = { json: JSON -> ::HttpBinUserAgentModel.create .map(json at "userAgent") .apply(json at "status") } Hmm
I think it is my fault because I switch Triple to Pair.
{"method":"GET","path":"/user-agent","headers":{"TE":["gzip, deflate; q=0.5"],"content-length":["0"],"Accept":["text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"],"User-Agent":["Java/1.8.0_181"],"Connection":["keep-alive"],"Host":["localhost:54045"]},"reflect":true,"userAgent":"Java/1.8.0_181"} no status