Skip to content

Commit

Permalink
Use Future.successful wherever possible
Browse files Browse the repository at this point in the history
  • Loading branch information
gravetii committed Nov 9, 2024
1 parent f14b9eb commit 271fdd4
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 271fdd4

Please sign in to comment.