小编A M*_*A M的帖子

处理POST方法请求Http4s的情况的正确方法

我有一个通过网络发送的 Post 请求,以获取与我使用 Http4s 的用户相关的数据。

在编写 HttpRoutes 时,我使用它来处理 POST 的情况,如下所示:

case req @ POST -> Root/ "posts" { "name": username, "friends": friends} =>
Run Code Online (Sandbox Code Playgroud)

thename和 thefriends是在请求​​正文中作为参数传递的属性。

然而,我似乎可以识别出一些语法错误'=>' expected but '{' found

post scala http http4s

2
推荐指数
1
解决办法
1236
查看次数

标签 统计

http ×1

http4s ×1

post ×1

scala ×1