Skip to content

Commit

Permalink
Use a val instead of a def
Browse files Browse the repository at this point in the history
  • Loading branch information
daddykotex committed Nov 3, 2022
1 parent 3680c3e commit 9962f80
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,22 @@ private[smithy4s] class SmithyHttp4sServerEndpointImpl[F[_], Op[_, _, _, _, _],
errorTransformation(other).flatMap(F.raiseError)
}

private def extractInput(metadata: Metadata, request: Request[F]): F[I] = {
private val extractInput: (Metadata, Request[F]) => F[I] = {
inputMetadataDecoder.total match {
case Some(totalDecoder) =>
request.body.compile.drain *>
totalDecoder.decode(metadata).liftTo[F]
(metadata, request) =>
request.body.compile.drain *>
totalDecoder.decode(metadata).liftTo[F]
case None =>
// NB : only compiling the input codec if the data cannot be
// totally extracted from the metadata.
implicit val inputCodec =
entityCompiler.compilePartialEntityDecoder(inputSchema, entityCache)
for {
metadataPartial <- inputMetadataDecoder.decode(metadata).liftTo[F]
bodyPartial <- request.as[BodyPartial[I]]
} yield metadataPartial.combine(bodyPartial)
(metadata, request) =>
implicit val inputCodec =
entityCompiler.compilePartialEntityDecoder(inputSchema, entityCache)
for {
metadataPartial <- inputMetadataDecoder.decode(metadata).liftTo[F]
bodyPartial <- request.as[BodyPartial[I]]
} yield metadataPartial.combine(bodyPartial)
}
}

Expand Down

0 comments on commit 9962f80

Please sign in to comment.