Skip to content

Commit

Permalink
Merge pull request #361 from gravetii/refactor_futures
Browse files Browse the repository at this point in the history
Use Future.successful wherever possible
  • Loading branch information
ornicar authored Nov 9, 2024
2 parents f14b9eb + 271fdd4 commit cfa5d85
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/client/src/main/scala/PlaySearchClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class PlaySearchClient(client: StandaloneWSClient, baseUrl: String)(using Execut
.url(url)
.post(data)
.flatMap:
case res if res.status == 200 => Future(res.body[R])
case res if res.status == 200 => Future.successful(res.body[R])
case res if res.status == 400 =>
Future.failed(SearchError.BadRequest(s"$url ${res.status} ${res.body}"))
case res => Future.failed(SearchError.InternalServerError(s"$url ${res.status} ${res.body}"))
Expand All @@ -79,7 +79,7 @@ class PlaySearchClient(client: StandaloneWSClient, baseUrl: String)(using Execut
.url(url)
.post(data)
.flatMap:
case res if res.status == 200 => Future(())
case res if res.status == 200 => Future.successful(())
case res if res.status == 400 =>
Future.failed(SearchError.BadRequest(s"$url ${res.status} ${res.body}"))
case res => Future.failed(SearchError.InternalServerError(s"$url ${res.status} ${res.body}"))
Expand All @@ -90,7 +90,7 @@ class PlaySearchClient(client: StandaloneWSClient, baseUrl: String)(using Execut
.url(url)
.execute("POST")
.flatMap:
case res if res.status == 200 => Future(())
case res if res.status == 200 => Future.successful(())
case res if res.status == 400 =>
Future.failed(SearchError.BadRequest(s"$url ${res.status} ${res.body}"))
case res => Future.failed(SearchError.InternalServerError(s"$url ${res.status} ${res.body}"))
Expand Down

0 comments on commit cfa5d85

Please sign in to comment.