gpt4 book ai didi

c# - 通过 Postman 插件将值 [FromBody] 传递给 post 方法时为空值

转载 作者:IT王子 更新时间:2023-10-29 04:04:30 24 4
gpt4 key购买 nike

<分区>

我在 ASP.net Web API 中使用 api Controller ,我需要通过 [FromBody] 类型将值传递给 post 方法..

 [HttpPost]
public HttpResponseMessage Post( [FromBody]string name)
{
....
}

我使用 Postman 插件,但是当发送到 name 的 post 方法值时总是 null.. 遵循这个图像: enter image description here

在 Post 方法中: enter image description here

为什么会这样?!

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com