Skip to content

Commit

Permalink
Merge pull request #21 from hmrc/BDOG-1368
Browse files Browse the repository at this point in the history
BDOG-1368: Correct error result on 404's
  • Loading branch information
IanMcShane committed Apr 14, 2021
2 parents 934c2cf + 9e19813 commit 1412a35
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions build.sbt
Expand Up @@ -5,17 +5,17 @@ val compileDependencies = PlayCrossCompilation.dependencies(
play26 = Seq(
"uk.gov.hmrc" %% "json-encryption" % "4.10.0-play-26",
"com.typesafe.play" %% "play-json" % "2.6.14",
"uk.gov.hmrc" %% "http-verbs-play-26" % "13.2.0"
"uk.gov.hmrc" %% "http-verbs-play-26" % "13.3.0"
),
play27 = Seq(
"uk.gov.hmrc" %% "json-encryption" % "4.10.0-play-27",
"com.typesafe.play" %% "play-json" % "2.7.4",
"uk.gov.hmrc" %% "http-verbs-play-27" % "13.2.0"
"uk.gov.hmrc" %% "http-verbs-play-27" % "13.3.0"
),
play28 = Seq(
"uk.gov.hmrc" %% "json-encryption" % "4.10.0-play-28",
"com.typesafe.play" %% "play-json" % "2.8.1",
"uk.gov.hmrc" %% "http-verbs-play-28" % "13.2.0"
"uk.gov.hmrc" %% "http-verbs-play-28" % "13.3.0"
)
)

Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Expand Up @@ -2,7 +2,7 @@ resolvers += Resolver.bintrayIvyRepo("hmrc", "sbt-plugin-releases")
resolvers += Resolver.bintrayRepo("hmrc", "releases")
resolvers += Resolver.typesafeRepo("releases")

addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "2.13.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "2.14.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-git-versioning" % "2.2.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-artifactory" % "1.13.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-play-cross-compilation" % "2.0.0")
Expand Up @@ -72,7 +72,7 @@ trait HttpCaching extends CachingVerbs {
implicit hc: HeaderCarrier,
executionContext: ExecutionContext): Future[Option[CacheMap]] =
get(buildUri(source, cacheId)).map(Some(_)).recover {
case e: NotFoundException => None
case UpstreamErrorResponse.WithStatusCode(404, _) => None
}

def fetchAndGetEntry[T](source: String, cacheId: String, key: String)(
Expand Down
Expand Up @@ -63,8 +63,7 @@ class HttpCachingClientSpec extends AnyWordSpecLike with Matchers with ScalaFutu
}

"return None if the map is not found" in {

val client = SessionCachingForTest(new NotFoundException("not found"))
val client = SessionCachingForTest(UpstreamErrorResponse("Not found", 404))
client.fetch().futureValue shouldBe None
}

Expand Down Expand Up @@ -181,7 +180,7 @@ class HttpCachingClientSpec extends AnyWordSpecLike with Matchers with ScalaFutu

"return None if the map is not found" in {

val client = ShortLivedCachingForTest(new NotFoundException("not found"))
val client = ShortLivedCachingForTest(UpstreamErrorResponse("Not found", 404))
client.fetch(id).futureValue shouldBe None
}

Expand Down

0 comments on commit 1412a35

Please sign in to comment.