Skip to content

Commit

Permalink
Remove unnecessary argument
Browse files Browse the repository at this point in the history
The additional argument snuck upon rebase confusing us how certain values
are calculated. This removes the argument and formatting issues that came
along.
  • Loading branch information
peel committed Jan 15, 2024
1 parent 3ebed61 commit 47e12a9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class Routes[F[_]: Sync](
path = path,
request = req,
pixelExpected = false,
doNotTrack = false,
contentType = req.contentType.map(_.value.toLowerCase)
)

Expand All @@ -64,7 +63,6 @@ class Routes[F[_]: Sync](
path = path,
request = req,
pixelExpected = true,
doNotTrack = false,
contentType = None
)

Expand All @@ -74,7 +72,6 @@ class Routes[F[_]: Sync](
path = req.pathInfo.renderString,
request = req,
pixelExpected = true,
doNotTrack = false,
contentType = None
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ trait IService[F[_]] {
path: String,
request: Request[F],
pixelExpected: Boolean,
doNotTrack: Boolean,
contentType: Option[String] = None
): F[Response[F]]
def determinePath(vendor: String, version: String): String
Expand Down Expand Up @@ -73,7 +72,6 @@ class Service[F[_]: Sync](
path: String,
request: Request[F],
pixelExpected: Boolean,
doNotTrack: Boolean,
contentType: Option[String] = None
): F[Response[F]] =
for {
Expand All @@ -87,15 +85,13 @@ class Service[F[_]: Sync](
queryString = Some(request.queryString)
cookie = extractCookie(request)
doNotTrack = checkDoNotTrackCookie(request)
alreadyBouncing = queryString.contains(config.cookieBounce.name)
alreadyBouncing = config.cookieBounce.enabled && queryString.contains(config.cookieBounce.name)
nuidOpt = networkUserId(request, cookie, spAnonymous)
nuid = nuidOpt.getOrElse {
if (alreadyBouncing) config.cookieBounce.fallbackNetworkUserId
else UUID.randomUUID().toString
}
shouldBounce = config.cookieBounce.enabled && nuidOpt.isEmpty && !alreadyBouncing &&
pixelExpected && !redirect

shouldBounce = config.cookieBounce.enabled && nuidOpt.isEmpty && !alreadyBouncing && pixelExpected && !redirect
(ipAddress, partitionKey) = ipAndPartitionKey(ip, config.streams.useIpAddressAsPartitionKey)
event = buildEvent(
queryString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class RoutesSpec extends Specification {
path: String,
request: Request[IO],
pixelExpected: Boolean,
doNotTrack: Boolean,
contentType: Option[String]
): IO[Response[IO]] =
IO.delay {
Expand All @@ -54,7 +53,7 @@ class RoutesSpec extends Specification {
path,
request,
pixelExpected,
doNotTrack,
false,
contentType
)
Response(status = Ok, body = Stream.emit("cookie").through(text.utf8.encode))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class ServiceSpec extends Specification {
path = "p",
request = request,
pixelExpected = false,
doNotTrack = false,
contentType = None
)
.unsafeRunSync()
Expand All @@ -100,7 +99,6 @@ class ServiceSpec extends Specification {
path = "p",
request = req,
pixelExpected = false,
doNotTrack = false,
contentType = Some("image/gif")
)
.unsafeRunSync()
Expand All @@ -124,7 +122,6 @@ class ServiceSpec extends Specification {
path = "p",
request = req,
pixelExpected = false,
doNotTrack = false,
contentType = Some("image/gif")
)
.unsafeRunSync()
Expand All @@ -150,7 +147,6 @@ class ServiceSpec extends Specification {
path = "p",
request = req,
pixelExpected = false,
doNotTrack = false,
contentType = Some("image/gif")
)
.unsafeRunSync()
Expand All @@ -173,7 +169,6 @@ class ServiceSpec extends Specification {
path = "p",
request = req,
pixelExpected = false,
doNotTrack = false,
contentType = Some("image/gif")
)
.unsafeRunSync()
Expand All @@ -199,7 +194,6 @@ class ServiceSpec extends Specification {
path = "p",
request = req,
pixelExpected = false,
doNotTrack = false,
contentType = Some("image/gif")
)
.unsafeRunSync()
Expand Down Expand Up @@ -228,7 +222,6 @@ class ServiceSpec extends Specification {
path = "p",
request = req,
pixelExpected = false,
doNotTrack = false,
contentType = Some("image/gif")
)
.unsafeRunSync()
Expand Down Expand Up @@ -275,7 +268,6 @@ class ServiceSpec extends Specification {
path = "p",
request = req,
pixelExpected = false,
doNotTrack = false,
contentType = Some("image/gif")
)
.unsafeRunSync()
Expand Down Expand Up @@ -303,7 +295,6 @@ class ServiceSpec extends Specification {
path = "p",
request = Request[IO](),
pixelExpected = true,
doNotTrack = false,
contentType = None
)
.unsafeRunSync()
Expand All @@ -320,7 +311,6 @@ class ServiceSpec extends Specification {
path = "p",
request = Request[IO](),
pixelExpected = true,
doNotTrack = false,
contentType = None
)
.unsafeRunSync()
Expand Down Expand Up @@ -354,7 +344,6 @@ class ServiceSpec extends Specification {
path = "p",
request = request,
pixelExpected = true,
doNotTrack = false,
contentType = None
)
.unsafeRunSync()
Expand Down Expand Up @@ -384,7 +373,6 @@ class ServiceSpec extends Specification {
path = testPath,
request = req,
pixelExpected = false,
doNotTrack = false,
contentType = None
)
.unsafeRunSync()
Expand Down Expand Up @@ -673,8 +661,8 @@ class ServiceSpec extends Specification {
headers = Headers.empty,
cookieConfig = testCookieConfig.copy(enabled = false),
networkUserId = "nuid",
doNotTrack = false,
spAnonymous = None,
doNotTrack = true,
now = now
) shouldEqual None
}
Expand All @@ -683,8 +671,8 @@ class ServiceSpec extends Specification {
headers = Headers.empty,
cookieConfig = testCookieConfig,
networkUserId = "nuid",
doNotTrack = true,
spAnonymous = None,
doNotTrack = true,
now = now
) shouldEqual None
}
Expand All @@ -693,8 +681,8 @@ class ServiceSpec extends Specification {
headers = Headers.empty,
cookieConfig = testCookieConfig,
networkUserId = "nuid",
doNotTrack = true,
spAnonymous = Some("*"),
doNotTrack = true,
now = now
) shouldEqual None
}
Expand All @@ -710,8 +698,8 @@ class ServiceSpec extends Specification {
headers = Headers.empty,
cookieConfig = conf,
networkUserId = nuid,
doNotTrack = false,
spAnonymous = None,
doNotTrack = false,
now = now
)
cookie.secure must beTrue
Expand Down

0 comments on commit 47e12a9

Please sign in to comment.