小编Eri*_* Li的帖子

在 gofiber POST 请求中,如何解析请求正文?

如果我将 JSON 数据发布到 gofiber 中的 /post route,我将如何读取和更改这些值:

{
    "name" : "John Wick"
    "email" : "johnw@gmail.com"
}
Run Code Online (Sandbox Code Playgroud)
app.Post("/post", func(c *fiber.Ctx) error {
    //read the req.body here
    name := req.body.name
    return c.SendString(name)
}
Run Code Online (Sandbox Code Playgroud)

post http go go-fiber

3
推荐指数
2
解决办法
1555
查看次数

标签 统计

go ×1

go-fiber ×1

http ×1

post ×1