From d5fd4d210eea7fd7e7ece1d8a78939397154b1bb Mon Sep 17 00:00:00 2001 From: Marco F Date: Tue, 21 Nov 2023 18:02:27 +0100 Subject: [PATCH] first attempt at fixing issue 1268 #4 --- .../webclient/src/main/scala/scaladex/client/Client.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/webclient/src/main/scala/scaladex/client/Client.scala b/modules/webclient/src/main/scala/scaladex/client/Client.scala index 305c0b877..8fbc08e40 100644 --- a/modules/webclient/src/main/scala/scaladex/client/Client.scala +++ b/modules/webclient/src/main/scala/scaladex/client/Client.scala @@ -101,7 +101,13 @@ object Client { } ) fetch(repoRequest).toFuture - .flatMap(res => res.text().toFuture) + .flatMap { res => + if (res.status == 200) { + res.text().toFuture + } else { + Future.successful("{\"default_branch\": \"master\"}") + } + } .flatMap { res => val resJson = js.JSON.parse(res) val branch = resJson.asInstanceOf[Repo].default_branch