I am using http4s version 0.18, with Circe and I am getting the error value decode is not a member of org.http4s.AuthedRequest when I converting the json body to a case class within an AuthedService with the following code:
// case class definition
case class UserUpdate(name: String)
import org.http4s.AuthedService
import org.http4s.circe._
val updateUserService: AuthedService[String, F] =
AuthedService {
case req @ PATCH -> Root / "mypath" as _ =>
req.decode[UserUpdate] { userUpdate =>
...
}
}
It turns out that, as the documentation specifies, that
AuthedServiceoperates onAuthedRequestwhich is equivalent to(User, Request[F]), so what needs to be done is to calldecodeon therequestpart of theAuthedRequest, see: