diff --git a/src/main/scala/plex/PlexUtils.scala b/src/main/scala/plex/PlexUtils.scala index 8ce9cbb..e569527 100644 --- a/src/main/scala/plex/PlexUtils.scala +++ b/src/main/scala/plex/PlexUtils.scala @@ -13,6 +13,8 @@ import io.circe.generic.extras.auto._ import io.circe.syntax.EncoderOps import org.http4s.client.UnexpectedStatus +import java.util.UUID + trait PlexUtils { private val logger = LoggerFactory.getLogger(getClass) @@ -21,7 +23,10 @@ trait PlexUtils { extras.Configuration.default.withDefaults protected def fetchWatchlistFromRss(client: HttpClient)(url: Uri): IO[Set[Item]] = { - val jsonFormatUrl = url.withQueryParam("format", "json") + val randomUUID = UUID.randomUUID().toString.take(12) + val jsonFormatUrl = url + .withQueryParam("format", "json") + .withQueryParam("cache_buster", randomUUID) client.httpRequest(Method.GET, jsonFormatUrl).map { case Left(UnexpectedStatus(s, _, _)) if s.code == 500 => diff --git a/src/test/scala/plex/PlexUtilsSpec.scala b/src/test/scala/plex/PlexUtilsSpec.scala index 7763a13..0a824ca 100644 --- a/src/test/scala/plex/PlexUtilsSpec.scala +++ b/src/test/scala/plex/PlexUtilsSpec.scala @@ -23,7 +23,7 @@ class PlexUtilsSpec extends AnyFlatSpec with Matchers with PlexUtils with MockFa (mockClient.httpRequest _) .expects( Method.GET, - Uri.unsafeFromString("http://localhost:9090?format=json"), + *, None, None ) @@ -40,7 +40,7 @@ class PlexUtilsSpec extends AnyFlatSpec with Matchers with PlexUtils with MockFa (mockClient.httpRequest _) .expects( Method.GET, - Uri.unsafeFromString("http://localhost:9090?format=json"), + *, None, None )