You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
JsonParser throws an exception when ResponseBody is an empty string. (In my case I use kotlinx_serialization.) square/retrofit#1554
Describe the solution you'd like
this case we need a way to handle empty strings.
Describe alternatives you've considered
Add [pre]converterFactory which can be called first in retrofitBuilder inside ApiClient. There is already converterFactory but it is not available in this case because it is added last.
@dylan-kwon did you test it?
I've tested in retrofit v2.9.0 and contentLegth() is always -1,
and it makes sense, since it will be set only when the response body is consumed by calling [ResponseBody instance].bytes() or [ResponseBody instance].byteString()
Is your feature request related to a problem? Please describe.
JsonParser throws an exception when ResponseBody is an empty string. (In my case I use kotlinx_serialization.)
square/retrofit#1554
Describe the solution you'd like
this case we need a way to handle empty strings.
Describe alternatives you've considered
Add
[pre]converterFactory
which can be called first inretrofitBuilder
inside ApiClient. There is alreadyconverterFactory
but it is not available in this case because it is added last.This allows you to add converters to suit your project's needs.
(In my case, adding
NullOnEmptyConverterFactory
can solve the problem.)This way, you can handle the response to suit your own requirements.
The text was updated successfully, but these errors were encountered: