I have an issue with load XML feed from url using Retrofit.
Given a dynamic url that clearly returns xml feed f.e: https://anchor.fm/s/53faae8/podcast/rss
When I try to load this via Retrofit I can see in Android Studio Network Profilier that it returns a scrambled response. Something like this:
ì½ÝvÜF’.z=ó5mÏ&d&€ÛmÊ’Ûš¶-K=š>{íµWH°`Ve EšsÕ÷çö¬5ûö
<X?ɉˆLüT‰jIUîÖL·šUäoDFdü|ñÙ?¯–Þ•iÚ²®~÷$8õŸx¦Ê꼬.~÷ä�o¾bêÉŸÖ´VíYžýîÉ¢ëÖgOŸ®7Íò´n.žæÙS³4+SuíÓà4xúÄ=›ÕU_¾û4úOWu¾Yšö©{pxQwõjxëúúúôZÐ{Ü÷ççðã“qȇl_+»MeÚ
Etc.
I've added an xml converter in my retrofitBuilder:
retrofitBuilder.addConverterFactory(SimpleXmlConverterFactory.createNonStrict(Persister(AnnotationStrategy())))
And my service code to retrieve the xml from url looks like: interface XmlFeedService {
@GET
fun getXmlFeedFromUrl(@Url url: String): Call<RssFeed>
I am using @Url annotation here since the url is dynamic and depending what another api returns to me can result in urls with different base url's.
Of course the response body can't be parsed like this, but I am unclear why it comes back like this. Can anyone help out?