Scala 值解码不是org.http4s.AuthedRequest的成员

Scala 值解码不是org.http4s.AuthedRequest的成员,scala,http4s,http4s-circe,Scala,Http4s,Http4s Circe,我使用的是http4sversion 0.18,带有Circe,当我使用以下代码将json主体转换为AuthedService中的case类时,我得到的错误是value decode不是org.http4s.AuthedRequest的成员: //案例类定义 案例类UserUpdate(名称:String) 导入org.http4s.AuthedService 导入org.http4s.circe_ val updateUserService:AuthedService[字符串,F]= 授权服务

我使用的是
http4s
version 0.18,带有Circe,当我使用以下代码将json主体转换为
AuthedService
中的
case类时,我得到的错误是
value decode不是org.http4s.AuthedRequest的成员:

//案例类定义
案例类UserUpdate(名称:String)
导入org.http4s.AuthedService
导入org.http4s.circe_
val updateUserService:AuthedService[字符串,F]=
授权服务{
case req@PATCH->Root/“mypath”as>
req.decode[UserUpdate]{UserUpdate=>
...
}
}
事实证明,正如指定的那样,
AuthedService
AuthedRequest
上运行,这相当于
(用户,请求[F])
,因此需要做的是调用
AuthedRequest
部分的
请求进行解码,请参见:

//案例类定义
案例类UserUpdate(名称:String)
导入org.http4s.AuthedService
导入org.http4s.circe_
val updateUserService:AuthedService[字符串,F]=
授权服务{
case authReq@PATCH->Root/“mypath”as>
authReq.req.decode[UserUpdate]{UserUpdate=>
...
}
}