我有一个通过网络发送的 Post 请求,以获取与我使用 Http4s 的用户相关的数据。
在编写 HttpRoutes 时,我使用它来处理 POST 的情况,如下所示:
case req @ POST -> Root/ "posts" { "name": username, "friends": friends} =>
Run Code Online (Sandbox Code Playgroud)
thename和 thefriends是在请求正文中作为参数传递的属性。
然而,我似乎可以识别出一些语法错误'=>' expected but '{' found。